summaryrefslogtreecommitdiff
path: root/src/look.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 00:08:16 -0300
committerGabriel Schneider <[email protected]>2026-11-05 00:32:56 -0300
commit2367ed34beccf3f2f1b8bbf6b8a171f50933d7a1 (patch)
tree8dcc7111d1e78806c6ac0e0bd1493c25d86bfc85 /src/look.zig
parent43a4c24e607a456d7a23eb8a779bce5651f18222 (diff)
downloadpardes-2367ed34beccf3f2f1b8bbf6b8a171f50933d7a1.tar.gz
pardes-2367ed34beccf3f2f1b8bbf6b8a171f50933d7a1.zip
config, exec, look: Placement, BootShell, LookWord, DirLook and DiffLook go, with what each kept of pardes before it took acme's ways (exec's pardesPlace, atFoot, belowParent, pardesDoc and evictLonePristineTty with mouse.zig's call, layout's splitParent and columnFitsHalves that only they called, look's ls in a terminal for a directory, the word and patch looks' other branches, the SPC c p key, their Help and builtins-JSON rows, their lines in docs/typ and a changelog line), and the tests of them: Dir.zig's "DirLook terminal: a look at a directory opens a terminal there, no pane listing it", pardes.zig's "first document fallback splits like Term from the originating pane", "first document keeps its originating shell and only opens a column when it fits", "BootShell keep leaves the untouched boot shell a dragged document joins; replace closes it" and "a Look on a directory does not type ls into an occupied terminal", keys.zig's "keys: SPC j n and SPC j p walk on from the place a Look's +Search listing chose, its keyboard left in the file", look_and_exec.zig's "look-and-exec: a second LookWord list look in a directory refills its +Search rather than stacking another", placement.zig's "placement: Placement pardes puts a new pane right under the asking one, and bare it steps back to acme", output.zig's "LookNext/LookPrev keeps the result output a Look chose through a no-match answer, and a stale serial once it is deleted", and the snapshot scripts that turned them on (cmdword, doccol, look-dir, lookpanes, rsearch, splitparent, ttylook); the Del question's test makes its middle panes the acme way, a New at the column's foot, and the others that turned one on for their layout run without it
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/look.zig')
-rw-r--r--src/look.zig28
1 files changed, 7 insertions, 21 deletions
diff --git a/src/look.zig b/src/look.zig
index 05cdd581..1f81d6ec 100644
--- a/src/look.zig
+++ b/src/look.zig
@@ -1330,8 +1330,7 @@ fn settleLine(p: *Pardes, id: usize, path: []const u8, at: Spot, before: usize,
/// A plain word looked at in a pane, as acme's look3 does with one that
/// names no file (look.c:210, search): its next place in that pane after
-/// the dot, wrapping to the top, is selected there. No +Search pane
-/// (`LookWord list` lists every place in one instead).
+/// the dot, wrapping to the top, is selected there. No +Search pane.
fn lookWord(p: *Pardes, id: usize, pane: *Pane, word: []const u8) void {
const ninep_pane = @import("ninep/pane.zig");
const f = pane.file orelse return;
@@ -1390,7 +1389,7 @@ fn lookUnresolved(p: *Pardes, id: usize, pane: *Pane, trimmed: []const u8, text:
if (pane.image != null or (pane.body.mode == .tty and !p.fs.serving)) return;
if (text.len == 0) return;
if (lookCommit(p, id, pane, trimmed)) return;
- if (p.settings.look_word == .search and pane.file != null) return lookWord(p, id, pane, text);
+ if (pane.file != null) return lookWord(p, id, pane, text);
p.word_look = true;
defer p.word_look = false;
const rows = runSearch(p, id, text, .cursor, false) catch |err| {
@@ -1826,21 +1825,8 @@ pub fn lookAt(p: *Pardes, id: usize, operand_raw: []const u8) void {
var said: [4200]u8 = undefined;
return p.reportFailure(id, std.fmt.bufPrint(&said, "look: {s}: no such directory", .{dir[0..@min(dir.len, 4096)]}) catch "look: no such directory");
};
- // acme's: a pane listing it (Dir.zig). `DirLook terminal`, what
- // pardes did before: `ls` in a terminal there.
- if (p.settings.dir_look == .pane) return panes.Dir.look(p, id, dir);
- for (p.panes, 0..) |slot, i| {
- if (slot) |tt| if (std.mem.eql(u8, tt.cwdSlice(), dir) and exec.takesCommandLine(p, i)) {
- clearNavigationSelection(p, tt);
- p.active = i;
- p.emitWrite(i, "ls\r");
- return;
- };
- }
- const free = p.freeSlot() orelse return p.reportError(id, "look", error.NoPaneSlots);
- const nt = p.newShell(free, dir) catch |err| return p.reportError(id, "look", err);
- nt.greet = true;
- exec.placeNew(p, id, id, free, .shell);
+ // acme's: a pane listing it (Dir.zig).
+ panes.Dir.look(p, id, dir);
},
.file => |target| {
if (comptime pdf_enabled) if (target.kind == .pdf) {
@@ -1872,9 +1858,9 @@ pub fn lookAt(p: *Pardes, id: usize, operand_raw: []const u8) void {
var opened: ?usize = null;
if (!focusPaneByPath(p, target.path, target.at)) {
// A .diff or .patch looked at bare: its hunks stacked in a
- // +Diff (DiffLook hunks), which takes the keyboard as the
- // file would; one with none in it opens as text.
- if (p.settings.diff_look == .hunks and !p.look_text and target.at.line == 0 and
+ // +Diff, which takes the keyboard as the file would; one
+ // with none in it opens as text.
+ if (!p.look_text and target.at.line == 0 and
(std.mem.endsWith(u8, target.path, ".diff") or std.mem.endsWith(u8, target.path, ".patch")))
if (filesystem.read(p, target.path)) |bytes| {
defer p.gpa.free(bytes);