From 331538de36f5869d984bbc6b1fcf167fb55d5290 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 21 Jan 2026 10:13:58 +0100 Subject: [PATCH] fix: detection of case in find mode should use case folding It was using is_lowercase, which only returns true for lowercase alpha characters and not other caseless symbols line numeric digits. Now we check that case_fold is a no-op instead. This has semantics that better match user expectations as case folding is also used in the actual search. closes #460 --- src/tui/mode/mini/find.zig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tui/mode/mini/find.zig b/src/tui/mode/mini/find.zig index 367ca0a..2a92e9a 100644 --- a/src/tui/mode/mini/find.zig +++ b/src/tui/mode/mini/find.zig @@ -13,6 +13,7 @@ const ed = @import("../../editor.zig"); const Allocator = @import("std").mem.Allocator; const eql = @import("std").mem.eql; const ArrayList = @import("std").ArrayList; +const Writer = @import("std").Io.Writer; const Self = @This(); const name = "󱎸 find"; @@ -130,7 +131,10 @@ fn flush_input(self: *Self) !void { } fn auto_detect_mode(self: *Self) Buffer.FindMode { - return if (Buffer.unicode.is_lowercase(self.input_.items)) .case_folded else .exact; + const pattern = self.input_.items; + const folded = Buffer.unicode.case_fold(self.allocator, pattern) catch return .case_folded; + defer self.allocator.free(folded); + return if (eql(u8, pattern, folded)) .case_folded else .exact; } fn cmd(self: *Self, name_: []const u8, ctx: command.Context) tp.result {