on master help sign in
Fix goto line end

Should not goto newline.

commitc2b937481fd3b4c630433de0fcc0a73ebee8c7b2 authorIvan Tham <pickfire@riseup.net> dateFri 25 Jun 2021, 00:47 (5 years ago) parent18beda3
1 file changed+4
helix-term/src/commands.rs+4
helix-term/src/commands.rs+4
@@ -351,6 +351,8 @@ fn move_line_end(cx: &mut Context) {
351351 let line = text.char_to_line(range.head);
352352
353353 let pos = line_end_char_index(&text.slice(..), line);
354+ let pos = graphemes::nth_prev_grapheme_boundary(text.slice(..), pos, 1);
355+ let pos = range.head.max(pos).max(text.line_to_char(line));
354356
355357 Range::new(pos, pos)
356358 });
@@ -787,6 +789,8 @@ fn extend_line_end(cx: &mut Context) {
787789 let line = text.char_to_line(range.head);
788790
789791 let pos = line_end_char_index(&text.slice(..), line);
792+ let pos = graphemes::nth_prev_grapheme_boundary(text.slice(..), pos, 1);
793+ let pos = range.head.max(pos).max(text.line_to_char(line));
790794
791795 Range::new(range.anchor, pos)
792796 });