From 523f08c28179fec32cbd0b707d79876d38788215 Mon Sep 17 00:00:00 2001 From: xoxorwr Date: Sat, 21 Feb 2026 22:18:03 +0100 Subject: [PATCH] Move right stops at last character --- src/tui/editor.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index c3cca5e..155b685 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -3697,7 +3697,15 @@ pub const Editor = struct { } pub fn move_cursor_word_right(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) error{Stop}!void { + const line_width = root.line_width(cursor.row, metrics) catch 0; + if (cursor.col >= line_width) { + cursor.move_down(root, metrics) catch return; + cursor.move_begin(); + return; + } move_cursor_right_until(root, cursor, is_word_boundary_right, metrics); + const new_line_width = root.line_width(cursor.row, metrics) catch 0; + if (cursor.col >= new_line_width) return; try move_cursor_right(root, cursor, metrics); }