summaryrefslogtreecommitdiff
path: root/src/colors.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 13:31:20 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:14 -0300
commit238e35e89d387f3c266b40f107e9419ea75d77bb (patch)
treed531d6aaa608c4e1f025969e4d4a1428efce3e70 /src/colors.zig
parent917e9a099f3a5048ac436aafcfabbf3d40d1c24f (diff)
downloadpardes-238e35e89d387f3c266b40f107e9419ea75d77bb.tar.gz
pardes-238e35e89d387f3c266b40f107e9419ea75d77bb.zip
Joincol with no column to the right and Theme with no such theme say so
Both did nothing without a word, from a click or a ctl write alike, and a script could not tell a no-op from success. Joincol in the rightmost column now fails 'Joincol: no column to the right'. A Theme name that is none says so and names the themes sharing its first letter, since all of them (ThemeSel lists them) are too many for a message or a refused write; a startup config line still fails quietly, as its other bad lines do. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/colors.zig')
-rw-r--r--src/colors.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/colors.zig b/src/colors.zig
index bb366fc0..8e608590 100644
--- a/src/colors.zig
+++ b/src/colors.zig
@@ -316,6 +316,19 @@ fn invalidateThemeDependentRasters(p: *Pardes) void {
};
}
+/// Themes whose names share `name`'s first letter, a line of them, for a
+/// Theme given a name there is none of: all of them (ThemeSel) are too many
+/// for a message or a refused write.
+pub fn themesNear(buf: []u8, name: []const u8) []const u8 {
+ var w = std.Io.Writer.fixed(buf);
+ for (themes) |t| {
+ if (name.len > 0 and std.ascii.toLower(t.name[0]) != std.ascii.toLower(name[0])) continue;
+ if (w.buffered().len + t.name.len + 1 > buf.len) break;
+ w.print("{s}{s}", .{ if (w.buffered().len > 0) " " else "", t.name }) catch break;
+ }
+ return w.buffered();
+}
+
pub fn setThemeIndex(p: *Pardes, index: usize) void {
if (index >= themes.len or
(p.custom_theme == null and p.theme_file_path.get().len == 0 and