summaryrefslogtreecommitdiff
path: root/src/builtins.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 00:13:11 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:14 -0300
commit42748f92b77367db415c8b4d0f2e537a9e1ddde7 (patch)
tree3ff6606d33149581d5954dcc900eb6ab3e4f0f17 /src/builtins.zig
parent23f430573efe4f6ef55b0180aa0d742ff4eca1d9 (diff)
downloadpardes-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/builtins.zig')
-rw-r--r--src/builtins.zig37
1 files changed, 33 insertions, 4 deletions
diff --git a/src/builtins.zig b/src/builtins.zig
index 743573e4..74645376 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -735,27 +735,56 @@ pub const Grep = struct {
// ---- the window group ----
+// The headers are above the panes in the same layout: Up from a pane with
+// nothing above it reaches its column's tag, then the workspace's, and Down
+// comes back the same way. Left and Right walk the column tags.
+
pub const Left = struct {
pub fn run(c: Ctx) void {
- layout.focusDir(c.p, c.id, .left);
+ if (c.p.header_focus) {
+ if (c.p.header_column) |column| if (column > 0) c.p.enterHeader(column - 1);
+ return;
+ }
+ _ = layout.focusDir(c.p, c.id, .left);
}
};
pub const Down = struct {
pub fn run(c: Ctx) void {
- layout.focusDir(c.p, c.id, .down);
+ if (c.p.header_focus) {
+ const column = layout.findPane(c.p, c.id);
+ if (c.p.header_column == null and c.p.columnBarHeight() > 0)
+ return c.p.enterHeader(if (column) |at| at.col else 0);
+ // Onto the top pane of the column the header stands over.
+ const col = c.p.header_column orelse if (column) |at| at.col else return;
+ c.p.exitHeader();
+ if (col < c.p.ncol and c.p.col_n[col] > 0) c.p.active = c.p.col_panes[col][0];
+ return;
+ }
+ _ = layout.focusDir(c.p, c.id, .down);
}
};
pub const Up = struct {
pub fn run(c: Ctx) void {
- layout.focusDir(c.p, c.id, .up);
+ if (c.p.header_focus) {
+ if (c.p.header_column != null and c.p.topBarHeight() > 0) c.p.enterHeader(null);
+ return;
+ }
+ if (layout.focusDir(c.p, c.id, .up)) return;
+ if (c.p.columnBarHeight() > 0) {
+ if (layout.findPane(c.p, c.id)) |at| c.p.enterHeader(at.col);
+ } else if (c.p.topBarHeight() > 0) c.p.enterHeader(null);
}
};
pub const Right = struct {
pub fn run(c: Ctx) void {
- layout.focusDir(c.p, c.id, .right);
+ if (c.p.header_focus) {
+ if (c.p.header_column) |column| if (column + 1 < c.p.ncol) c.p.enterHeader(column + 1);
+ return;
+ }
+ _ = layout.focusDir(c.p, c.id, .right);
}
};