From cef529dc8cd080198f79d2b26bffbe9c7cf3e8bd Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 11:46:38 -0300 Subject: Theme takes a name in any case, and a miss names its nearest themes Names were case-sensitive, and a miss listed only the first letter's themes that fitted 40 bytes, 4 of the many d ones. It now lists every theme sharing the first letter when they fit the 128 bytes an Rerror carries, else the nearest by a plain likeness score (shared prefix, the name inside, its letters in order). Co-Authored-By: Claude Opus 5.5 --- src/exec.zig | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/exec.zig') diff --git a/src/exec.zig b/src/exec.zig index 683b2f04..9ec6a426 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -906,15 +906,12 @@ pub fn applySettingBuiltin(p: *Pardes, setting: config.Runtime.Setting, arg: ?[] switch (setting.action) { .theme => { const want = std.mem.trim(u8, arg orelse return, " \t\r\n"); - for (themes, 0..) |t, i| if (std.mem.eql(u8, t.name, want)) { - colors.setThemeIndex(p, i); - return; - }; + if (colors.themeIndex(want)) |i| return colors.setThemeIndex(p, i); // A config line is not answered on screen (applyStartupConfig // runs with announce off); a click or a ctl write is. if (!p.announce) return; - var near: [96]u8 = undefined; - var text: [200]u8 = undefined; + var near: [170]u8 = undefined; + var text: [256]u8 = undefined; return p.reportFailure(p.active, std.fmt.bufPrint(&text, "Theme: no theme \"{s}\"; like it: {s}; Themes lists all", .{ want[0..@min(want.len, 40)], colors.themesNear(&near, want) }) catch "Theme: no such theme"); }, .font => { -- cgit v1.3