summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 11:46:38 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commitcef529dc8cd080198f79d2b26bffbe9c7cf3e8bd (patch)
treeb6f98f447572d9e9c94c27981b737e897268d1a0 /src/exec.zig
parent261eb7ac3f090c8ce47ad47c0f58f824a9b162a6 (diff)
downloadpardes-cef529dc8cd080198f79d2b26bffbe9c7cf3e8bd.tar.gz
pardes-cef529dc8cd080198f79d2b26bffbe9c7cf3e8bd.zip
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 <[email protected]>
Diffstat (limited to 'src/exec.zig')
-rw-r--r--src/exec.zig9
1 files changed, 3 insertions, 6 deletions
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 => {