diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 00:13:11 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | 42748f92b77367db415c8b4d0f2e537a9e1ddde7 (patch) | |
| tree | 3ff6606d33149581d5954dcc900eb6ab3e4f0f17 /src/dump.zig | |
| parent | 23f430573efe4f6ef55b0180aa0d742ff4eca1d9 (diff) | |
| download | pardes-42748f92b77367db415c8b4d0f2e537a9e1ddde7.tar.gz pardes-42748f92b77367db415c8b4d0f2e537a9e1ddde7.zip | |
Make the column and workspace tags Texts with the pane tag's keys
The headers had their own one-line editor with its own keys: Enter always
executed, h/l and J/K moved between headers and panes, Ctrl-c/x/v cut and
pasted, and TagLine refused a newline that 9P accepted. They are now Texts
like a pane's tag, with no prefix and a default until edited, so normal and
insert mode, undo and the look and execute keys are the body's. Moving
between them is the window keys' job: Up from a pane with nothing above it
reaches its column's tag and then the workspace's, Down comes back, and
Left and Right walk the column tags.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/dump.zig')
| -rw-r--r-- | src/dump.zig | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/dump.zig b/src/dump.zig index 7112e1f0..aeb25a90 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -191,8 +191,10 @@ pub const State = struct { mounts: []const Mount = &.{}, }; +/// A header is a text like any other: it may hold newlines, but not a +/// carriage return or a NUL. fn validateTag(bar: []const u8) !void { - if (bar.len > limits.max_tag_tail or std.mem.indexOfAny(u8, bar, "\r\n\x00") != null or !std.unicode.utf8ValidateSlice(bar)) return error.BadDumpTag; + if (bar.len > limits.max_tag_tail or std.mem.indexOfAny(u8, bar, "\r\x00") != null or !std.unicode.utf8ValidateSlice(bar)) return error.BadDumpTag; } pub fn validate(state: State) !void { @@ -637,7 +639,7 @@ pub fn dumpState(p: *Pardes) !void { }; if (ids_len > 0) { columns[columns_len] = .{ - .tag = if (p.col_tags[c].custom) p.columnTag(c) else null, + .tag = p.col_tags[c].own, .weight = @as(f32, @floatFromInt(p.col_weight[c])) / @as(f32, @floatFromInt(column_weight_unit)), .panes = column_ids[c][0..ids_len], }; @@ -651,7 +653,7 @@ pub fn dumpState(p: *Pardes) !void { .screen = .{ .cols = p.screen_w, .rows = p.screen_h }, .active = slot_to_pane[p.active] orelse 0, .topbar = config.topbar_str, - .topbar_custom = if (p.global_tag.custom) p.global_tag.slice("") else null, + .topbar_custom = p.global_tag.own, .theme = p.theme().name, .locations_config = p.locations_config, .tree_context_tag_style = p.settings.tree_context_tag_style, @@ -788,9 +790,9 @@ fn initDump(gpa: std.mem.Allocator, opts: Options, zon_bytes: []const u8, previo } p.ncol = @min(st.columns.len, MAX_COLS); p.col_serial = @splat(0); - if (st.topbar_custom) |bar| _ = p.global_tag.set(bar); + if (st.topbar_custom) |bar| p.global_tag.own = try p.gpa.dupe(u8, bar); for (st.columns[0..p.ncol], 0..) |col, c| { - if (col.tag) |bar| _ = p.col_tags[c].set(bar); + if (col.tag) |bar| p.col_tags[c].own = try p.gpa.dupe(u8, bar); const scaled = @as(f64, @floatCast(col.weight)) * @as(f64, @floatFromInt(column_weight_unit)); const bounded = @min(scaled, @as(f64, @floatFromInt(max_column_weight))); p.col_weight[c] = @max(1, @as(u64, @intFromFloat(@round(bounded)))); |
