From 1ad6b8db3d6fbd42595f9794d8fff425039371a5 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Fri, 3 Jan 2025 21:04:32 +0100 Subject: [PATCH] fix: clamp cursor to buffer in toggle_cursel_prefix --- src/tui/editor.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 32c0bae..9274e04 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -2723,6 +2723,7 @@ pub const Editor = struct { const new_text = text_manip.toggle_prefix_in_text(self.prefix, text, alloc) catch return error.Stop; root = self.insert(root, cursel, new_text, allocator) catch return error.Stop; cursel.* = saved; + cursel.cursor.clamp_to_buffer(root, self.metrics); return root; }