From 56238c776d85027a5526f47c517f98fb01a3ed61 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Tue, 3 Feb 2026 16:20:47 +0100 Subject: [PATCH] fix: clamp cursor to buffer in indent command --- src/tui/editor.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 4ebad96..3869249 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -4208,8 +4208,13 @@ pub const Editor = struct { root = try self.indent_cursor(root, sel.end, true, allocator); if (sel_from_start) sel_.begin.col = 0; + cursel.cursor.clamp_to_buffer(root, self.metrics); return root; - } else return try self.indent_cursor(root_, cursel.cursor, self.cursels.items.len > 1, allocator); + } else { + const root = try self.indent_cursor(root_, cursel.cursor, self.cursels.items.len > 1, allocator); + cursel.cursor.clamp_to_buffer(root, self.metrics); + return root; + } } pub fn indent(self: *Self, ctx: Context) Result {