summaryrefslogtreecommitdiff
path: root/src/output_pane.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-08-14 13:40:29 -0300
committerGabriel Schneider <[email protected]>2026-08-15 11:57:13 -0300
commitf67fec978a9296c651ec06bd2f43686d34ff86ee (patch)
treecbf5568883e5888398e0887093fc5afc524fd54d /src/output_pane.zig
parent9280c597b000eed661fd98793e182fdcb640f6cd (diff)
downloadpardes-f67fec978a9296c651ec06bd2f43686d34ff86ee.tar.gz
pardes-f67fec978a9296c651ec06bd2f43686d34ff86ee.zip
look: richer path/range parsing, pdf rendering, corner-drag and stepgrain snapshots
Diffstat (limited to 'src/output_pane.zig')
-rw-r--r--src/output_pane.zig35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/output_pane.zig b/src/output_pane.zig
index 37ec6033..f14d9a51 100644
--- a/src/output_pane.zig
+++ b/src/output_pane.zig
@@ -82,6 +82,11 @@ pub const Traits = struct {
/// n/N walk the rows: each is a `path:LINE:COL text` location the ordinary
/// look path resolves, so the buffer IS helix's picker. Prose (a hover
/// blurb, a formatting diff) has nowhere to step to.
+ ///
+ /// It is also what makes a step ROW-GRAINED (Grain below): one stop per
+ /// row, on the location at its head. A pane whose lines are free text —
+ /// a terminal, a file, a PDF, and the prose buffers here — steps every
+ /// look-able word instead, several to a line.
steps: bool = false,
/// ...and WHAT THE ROWS ARE. Off, each is a LOCATION with a look-able
/// `path:LINE:COL` word inside it. On, each is a COMMAND LINE — the whole
@@ -89,9 +94,9 @@ pub const Traits = struct {
/// with no path in it to pick out.
///
/// TWO readers, one fact, which is why the column is named for the fact:
- /// n/N (lookWalk) select the look-able span inside a location row, and
- /// THE WHOLE LINE of a command row, since the line is
- /// the unit there. Either way they only select; Enter
+ /// n/N (lookWalk) select the location at the head of a location row,
+ /// and THE WHOLE LINE of a command row, since the line
+ /// is the unit there. Either way they only select; Enter
/// looks what they left, Tab runs it.
/// searchStep Looks a location row's leading word and Execs a
/// command row whole — still how `]d`/`[d` and acme's
@@ -172,6 +177,30 @@ pub fn fileTraits(out: ?Output) Traits {
return traits((out orelse return file_row).from);
}
+/// How much of a row ONE n/N step selects (Pardes.lookSpanIn). Derived from
+/// the two columns above rather than a third one, because it is not a fact
+/// about a buffer — it is what those facts MEAN to the walk.
+pub const Grain = enum {
+ /// every look-able word, several to a line, in document order. Free text:
+ /// a terminal's scrollback, a file, a PDF, and an output buffer of PROSE,
+ /// where the place you want may be mid-sentence.
+ word,
+ /// the location at the head of the row, and one stop per row. A results
+ /// buffer is a LIST: the words after a row's location are the matched
+ /// text, and stepping onto them was stepping onto the same hit twice.
+ line,
+ /// the whole row: a command list, where the line is the word.
+ whole,
+};
+
+/// The grain of a pane's rows, off its `output` field — null (a real file)
+/// included, which is why a file pane is unaffected by any of this.
+pub fn grain(out: ?Output) Grain {
+ const tr = fileTraits(out);
+ if (tr.commands) return .whole;
+ return if (tr.steps) .line else .word;
+}
+
/// How the dump spells an origin. A WORD, never an integer, for the reason the
/// dump already stores tag words: reordering builtins.zig stays free. Nothing
/// collides — a builtin is CamelCase, an lsp.Kind is snake_case, and `/` is