From 54c68df967e93e288aea028965782c88238a47d7 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Mon, 17 Nov 2025 19:52:26 +0100 Subject: [PATCH] fix: auto_find should always clear last_match_text --- src/tui/editor.zig | 7 ++----- src/tui/mainview.zig | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 92c734a..5dd92b8 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -1951,12 +1951,9 @@ pub const Editor = struct { self.match_done_token = self.match_token; } - pub fn clear_matches_if_type(self: *Self, match_type: Match.Type) bool { - if (self.match_type == match_type) { + pub fn clear_matches_if_type(self: *Self, match_type: Match.Type) void { + if (self.match_type == match_type) self.clear_matches(); - return true; - } - return false; } pub fn sort_matches(self: *Self) void { diff --git a/src/tui/mainview.zig b/src/tui/mainview.zig index 111b53c..d822bde 100644 --- a/src/tui/mainview.zig +++ b/src/tui/mainview.zig @@ -1445,8 +1445,8 @@ fn location_jump(from: tp.pid_ref, file_path: []const u8, cursor: location_histo } fn clear_auto_find(self: *Self, editor: *ed.Editor) void { - if (editor.clear_matches_if_type(.auto_find)) - self.store_last_match_text(null); + editor.clear_matches_if_type(.auto_find); + self.store_last_match_text(null); } fn is_last_match_text(self: *Self, text: []const u8) bool {