summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-21 22:53:57 -0300
committerGabriel Schneider <[email protected]>2026-10-22 10:03:15 -0300
commit6076ab9e805838d4c4e8bb795428fae0a85671e9 (patch)
treeffbc0b1cfb803be44ff5ba65486ba42229df2ce7
parent1c6ebadde64b2e0f416550f9fc806dfc3c80b5c1 (diff)
downloadpardes-6076ab9e805838d4c4e8bb795428fae0a85671e9.tar.gz
pardes-6076ab9e805838d4c4e8bb795428fae0a85671e9.zip
Window mode: the pane's letter in its tag's box, no message
-rw-r--r--docs/typ/guide.typ2
-rw-r--r--src/CHANGELOG.md4
-rw-r--r--src/builtins.zig1
-rw-r--r--src/draw.zig17
-rw-r--r--src/pardes.zig6
5 files changed, 14 insertions, 16 deletions
diff --git a/docs/typ/guide.typ b/docs/typ/guide.typ
index 2833f705..78710c73 100644
--- a/docs/typ/guide.typ
+++ b/docs/typ/guide.typ
@@ -54,7 +54,7 @@ it is a plain Esc. The previous pane is the last one you jumped from, else
the next pane down the column.
#pairs(
- [#key("Ctrl-w") or #key("SPC w")], [window mode (#word("Window")): every pane shows a letter and the focused one is outlined; #keys("h", "j", "k", "l") move the outline, #key("Enter") or #key("Esc") gives that pane the keyboard, #key(":") its tag, a pane's letter gives it that one. #key("k") past a column's top pane goes on to its tag],
+ [#key("Ctrl-w") or #key("SPC w")], [window mode (#word("Window")): each pane's tag box shows a letter instead of its mode, and the focused pane's tag is outlined; #keys("h", "j", "k", "l") move the outline, #key("Enter") or #key("Esc") gives that pane the keyboard, #key(":") its tag, a pane's letter gives it that one. #key("k") past a column's top pane goes on to its tag],
[#keys("Ctrl-o", "Ctrl-i")], [back and forward through the places you jumped to (the jump list), this file's first: another file's only once it has none left that way (#word("JumpScope") `all`: every place in order)],
)
diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md
index 6ebabb5b..ab9432ef 100644
--- a/src/CHANGELOG.md
+++ b/src/CHANGELOG.md
@@ -29,8 +29,8 @@
restores the old way round. A terminal without the kitty keyboard
protocol sends Shift-Esc as a plain Esc, so under one a program gets
no Esc unless ProgramEsc is on.
-- Window mode (`Window`, Ctrl-w or SPC w): every pane shows a letter
- and the focused one is outlined; h/j/k/l move the outline without
+- Window mode (`Window`, Ctrl-w or SPC w): each pane's tag box shows a
+ letter in place of its mode, and the focused pane's tag is outlined; h/j/k/l move the outline without
giving any pane the keys, Enter or Esc focuses the outlined pane, `:`
its tag, and a
pane's letter jumps straight to it. Ctrl-w h/j/k/l and SPC w h/j/k/l
diff --git a/src/builtins.zig b/src/builtins.zig
index 6ecd3c9e..46b61ff7 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -1825,7 +1825,6 @@ pub const Window = struct {
pub fn run(c: Ctx) void {
tagline.exitHeader(c.p);
c.p.window_pick = if (c.p.panes[c.id] != null) c.id else c.p.active;
- c.p.setMessage(c.p.window_pick.?, "Window: h/j/k/l move, Enter or Esc focuses the outlined pane, : its tag, a letter that pane");
}
};
diff --git a/src/draw.zig b/src/draw.zig
index 1cf136bd..3d0d4d3c 100644
--- a/src/draw.zig
+++ b/src/draw.zig
@@ -941,7 +941,9 @@ fn renderPane(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r:
.bg = .{ .rgb = band },
.font_role = .tagline,
});
- s.set(r.x, tag_y, switch (pane.body.mode) {
+ // In window mode the box holds the pane's letter instead of its mode.
+ const label: ?u8 = if (p.window_pick != null) layout.windowLabel(p, id) else null;
+ s.set(r.x, tag_y, if (label) |*letter| @as(*const [1]u8, letter) else switch (pane.body.mode) {
.normal => config.tag_normal,
.insert => config.tag_insert,
.tty => config.tag_tty,
@@ -1209,19 +1211,14 @@ fn joinPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r
var temporary: Surface = .{ .cols = columns + TAG_TEXT_INSET, .rows = rows, .cells = storage };
try paintPaneTag(p, &temporary, arena, pane, .{ .x = 0, .y = 0, .w = columns + TAG_TEXT_INSET, .h = rows }, id, active, capacity);
// Window mode (layout.windowKey): the outlined pane's tag in the
- // selection's colours, and each pane's letter over its tag's start.
- if (p.window_pick) |pick| {
+ // selection's colours.
+ if (p.window_pick == id) {
const th = p.theme();
- if (pick == id) for (storage) |*cell| {
+ for (storage) |*cell| {
cell.style.bg = .{ .rgb = th.sel_bg };
cell.style.fg = .{ .rgb = th.sel_fg };
cell.default = false;
- };
- if (layout.windowLabel(p, id)) |letter| if (columns >= 3) for (" ? ", 0..) |ch, i| {
- const at = temporary.at(@intCast(TAG_TEXT_INSET + i), 0);
- const style: CellStyle = .{ .fg = .{ .rgb = chrome.tag_bg }, .bg = .{ .rgb = chrome.tag_fg }, .bold = true, .font_role = at.style.font_role };
- temporary.set(@intCast(TAG_TEXT_INSET + i), 0, &.{if (ch == '?') letter else ch}, style);
- };
+ }
}
const tag_fg: Color = .{ .rgb = if (active and p.settings.focus_tint) chrome.tag_active_fg else chrome.tag_fg };
// One layer, a row to each line the tag shows.
diff --git a/src/pardes.zig b/src/pardes.zig
index cb2ebe56..aaa9d177 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -8581,13 +8581,15 @@ test "window mode moves an outline and focuses it on Enter, Esc or a label" {
try std.testing.expect(p.executeBuiltinLine(p.active, "Window"));
p.update(.{ .key = .{ .cp = 'a', .text = "a" } });
try std.testing.expectEqual(@as(usize, 0), p.active);
- // Painted: the outlined tag's band in the selection colour, a label on each.
+ // Painted: the outlined tag's band in the selection colour, each pane's
+ // letter in its tag's box.
try std.testing.expect(p.executeBuiltinLine(p.active, "Window"));
var arena: std.heap.ArenaAllocator = .init(std.testing.allocator);
defer arena.deinit();
const shown = try p.render(arena.allocator());
try std.testing.expectEqual(p.theme().sel_bg, shown.tag_layers[0].bg);
- try std.testing.expectEqualStrings("a", shown.tag_layers[0].cells[1].text[0..shown.tag_layers[0].cells[1].len]);
+ const box = shown.at(p.rects[0].x, p.tagTop(p.panes[0].?, p.rects[0]));
+ try std.testing.expectEqualStrings("a", box.text[0..box.len]);
}
test "raw tty Ctrl-B switches to editor mode without sending child input" {