aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Tham2021-06-24 16:47:04 +0000
committerNathan Vegdahl2021-06-25 01:34:23 +0000
commitc2b937481fd3b4c630433de0fcc0a73ebee8c7b2 (patch)
tree8d743cbeb4194547404a996707c03e84027cbbd4
parent18beda38ac9dfec843dcbb51adf596e294fc13b2 (diff)
Fix goto line end
Should not goto newline.
-rw-r--r--helix-term/src/commands.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index d48a2099..d99c840f 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -351,6 +351,8 @@ fn move_line_end(cx: &mut Context) {
let line = text.char_to_line(range.head);
let pos = line_end_char_index(&text.slice(..), line);
+ let pos = graphemes::nth_prev_grapheme_boundary(text.slice(..), pos, 1);
+ let pos = range.head.max(pos).max(text.line_to_char(line));
Range::new(pos, pos)
});
@@ -787,6 +789,8 @@ fn extend_line_end(cx: &mut Context) {
let line = text.char_to_line(range.head);
let pos = line_end_char_index(&text.slice(..), line);
+ let pos = graphemes::nth_prev_grapheme_boundary(text.slice(..), pos, 1);
+ let pos = range.head.max(pos).max(text.line_to_char(line));
Range::new(range.anchor, pos)
});