summaryrefslogtreecommitdiff
path: root/core/draw.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-24 22:32:25 -0300
committerGabriel Schneider <[email protected]>2026-11-24 22:32:25 -0300
commit791d47a64db09f842d23b3d0b03c40951f30aae6 (patch)
treed2d8b9fa92055748d866d9296b26ae995df59172 /core/draw.zig
parent89b3e7365bac28c4cd7d52d40c1786c01db5af52 (diff)
downloadpardes-791d47a64db09f842d23b3d0b03c40951f30aae6.tar.gz
pardes-791d47a64db09f842d23b3d0b03c40951f30aae6.zip
walk: Enter on a word of the walk with the keyboard in the tag Looks it as a click does (Tab Execs it, as B2), and out of rest the walk folds to its newest word, its older ones `·` (pick-ui SPEC §6.3, §3.4.3, walk UI line F item 5, the gaps line B left): keys.zig handleKey's Enter-in-a-tag asks tagline.trailAt at the cursor's byte before taking the word as a builtin's operand, the keyboard back in the body as a click leaves it; Trail.folded says how many back steps a tag writes whole (shown_steps at rest, one while TagState.hostOf is its pane), which Trail.write, bytes and stepAt now take (wordOf's fold the caller's), so the name's offset (tagline.nameAt), the forward span, a click on a step, the drafted name and the name's tint all read the trail as it is drawn (nameAt, forwardSpan, onName and draw.tagTintRange take the session); TEST: Trail.zig "Enter on a word of the walk, the keyboard in the tag, goes back to its step ..." (SPC folds `‹@pN › · › rank.zig:20 ›`, Esc unfolds, Enter on rank.zig:10 goes back there); core-test 1026/1193 (167 skipped), 0 failed, load 8
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'core/draw.zig')
-rw-r--r--core/draw.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/draw.zig b/core/draw.zig
index 5282b1c9..cf62adf8 100644
--- a/core/draw.zig
+++ b/core/draw.zig
@@ -631,7 +631,7 @@ fn joinCells(s: *Surface, x: u16, y: u16, cells: []const Cell, from: usize, w: u
if (!cells[from].default and cells[from].len == 0) blank(&row[x], ink);
}
-fn tagTintRange(pane: *const Pane, tag: []const u8, prefix_len: usize) ?struct { lo: usize, hi: usize } {
+fn tagTintRange(p: *const Pardes, pane: *const Pane, tag: []const u8, prefix_len: usize) ?struct { lo: usize, hi: usize } {
if (pane.isTerminal()) {
// `tag` is the first row; a prefix longer than it ran to a second.
var words = std.mem.tokenizeAny(u8, tag[@min(prefix_len, tag.len)..], " \t\r\n");
@@ -642,7 +642,7 @@ fn tagTintRange(pane: *const Pane, tag: []const u8, prefix_len: usize) ?struct {
}
return null;
}
- var start: usize = tagline.nameAt(pane);
+ var start: usize = tagline.nameAt(p, pane);
const name = if (pane.file) |file|
if (pane.prompt == .name) pane.input.own orelse file.path else file.path
else if (pane.addon) |k| blk: {
@@ -955,7 +955,7 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane,
else if (pane.prompt == .name) caret: {
// A drafted name is the prefix: its caret is on row 0 of the tag,
// the rows it wrapped onto included.
- const at = modal.positionAt(shown.text, shown.fromReal(tagline.nameAt(pane) + @as(usize, @intCast(@max(0, pane.input.cur_col)))));
+ const at = modal.positionAt(shown.text, shown.fromReal(tagline.nameAt(p, pane) + @as(usize, @intCast(@max(0, pane.input.cur_col)))));
if (at.row < top or at.row >= top + rows) break :caret null;
break :caret .{ .row = at.row - top, .at = @min(lines[at.row - top].len, at.col) };
} else if (pane.focus == .tag and pane.prompt == .none and head == null) caret: {
@@ -975,10 +975,10 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane,
// The name's tint, in the tag's first line, over whichever rows it
// wrapped onto.
const first_line = whole[0 .. std.mem.indexOfScalar(u8, whole, '\n') orelse whole.len];
- if (tagTintRange(pane, first_line, prefix_len)) |name| if (name.lo < name.hi)
+ if (tagTintRange(p, pane, first_line, prefix_len)) |name| if (name.lo < name.hi)
inkTag(p, s, shown, lines[0..rows], top, tx, tag_y, tw, name.lo, @min(name.hi, first_line.len), if (active) chrome.tag_active_name_fg else chrome.tag_name_fg);
// A walk's forward steps, after the name, dimmed (Trail.zig).
- const ahead = tagline.forwardSpan(pane);
+ const ahead = tagline.forwardSpan(p, pane);
if (ahead[0] < ahead[1]) inkTag(p, s, shown, lines[0..rows], top, tx, tag_y, tw, ahead[0], @min(ahead[1], first_line.len), chrome.lineno);
// The head's keys in the key ink, its dimmed, underlined and struck
// words (TagState.Span), over whichever rows they wrapped onto.