From 9892e693b0d72e4fe8f196fcbe81a99d3f6eb17f Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 9 Apr 2025 14:50:19 +0200 Subject: [PATCH] fix: insert right char on move failure in smart_insert_pair_close closes #228 --- src/tui/editor.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 06564af..f87d199 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -4387,7 +4387,9 @@ pub const Editor = struct { break :blk; }; if (std.mem.eql(u8, egc, chars_right)) { - cursel.cursor.move_right(root, self.metrics) catch {}; + cursel.cursor.move_right(root, self.metrics) catch { + root = try self.insert(root, cursel, chars_right, b.allocator); + }; } else { root = try self.insert(root, cursel, chars_right, b.allocator); }