1
0
mirror of https://github.com/helix-editor/helix synced 2024-11-10 10:34:45 +01:00

Fix goto line end

Should not goto newline.
This commit is contained in:
Ivan Tham 2021-06-25 00:47:04 +08:00 committed by Nathan Vegdahl
parent 18beda38ac
commit c2b937481f

@ -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)
});