word left stops before newline when moved from other line

This commit is contained in:
xoxorwr 2026-02-22 08:21:21 +01:00 committed by CJ van den Berg
parent 523f08c281
commit 2266c92eab

View file

@ -3672,6 +3672,11 @@ pub const Editor = struct {
} }
pub fn move_cursor_word_left(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) error{Stop}!void { pub fn move_cursor_word_left(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) error{Stop}!void {
if (cursor.col == 0) {
cursor.move_up(root, metrics) catch return;
cursor.move_end(root, metrics);
return;
}
try move_cursor_left(root, cursor, metrics); try move_cursor_left(root, cursor, metrics);
move_cursor_left_until(root, cursor, is_word_boundary_left, metrics); move_cursor_left_until(root, cursor, is_word_boundary_left, metrics);
} }