diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 06:05:56 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | 98ed98178b667e551ff2bcaeb981e70d1f6ccb1f (patch) | |
| tree | ceaa740ffd8367c81ee8b09827f1464ec366d8c7 | |
| parent | 554181b73fd53b898841203066382e4287b83e89 (diff) | |
| download | pardes-98ed98178b667e551ff2bcaeb981e70d1f6ccb1f.tar.gz pardes-98ed98178b667e551ff2bcaeb981e70d1f6ccb1f.zip | |
A word written to a raw terminal's look is listed, as in normal mode
A new Tty is in raw mode, where a right click is its program's, and a
look written to it over 9P did nothing for that reason. The look file is
no keyboard input: over 9P a plain word is listed in a +Search pane and
read back whatever the terminal's key mode.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
| -rw-r--r-- | src/look.zig | 4 | ||||
| -rw-r--r-- | src/ninep/ctl.zig | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/look.zig b/src/look.zig index 796eb5bb..8318973b 100644 --- a/src/look.zig +++ b/src/look.zig @@ -1340,7 +1340,9 @@ pub fn lookAt(p: *Pardes, id: usize, operand: []const u8) void { if (found != .none) clearNavigationSelection(p, pane); switch (found) { .none => { - if (pane.image != null or pane.body.mode == .tty) return; + // A raw terminal's clicks are its program's; a look written over + // 9P is no keyboard input, and searches whatever the key mode. + if (pane.image != null or (pane.body.mode == .tty and !p.fs.serving)) return; if (p.settings.look_word == .search and pane.file != null) return lookWord(p, id, pane, trimmed); const rows = runSearch(p, id, trimmed, .text, .cursor, false) catch |err| { p.reportError(id, "search", err); diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 3f7da44c..d623296b 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1877,3 +1877,16 @@ test "a builtin that fails through exec, tagexec or a column's exec fails the wr try testing.expect(th.logHas(p, "look: no match for \"zzqqnotthere\"")); try testing.expect(!th.logHas(p, "msg 1 Look: no match")); } + +test "a word written to a raw terminal's look is listed as in normal mode" { + const p = try th.withTerm(testing.allocator); + defer p.deinit(); + const serial = serialOf(p); + const id = p.paneBySerial(serial).?; + p.update(.{ .output = .{ .pane = @intCast(id), .bytes = "one MARK two\r\n" } }); + p.panes[id].?.body.mode = .tty; + try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .look), "MARK\n").reply.status); + const said = std.mem.trimEnd(u8, rd(p, Node.of(serial, .look), 0, 64).bytes, "\n"); + const made = p.panes[p.paneBySerial(try std.fmt.parseInt(u32, said, 10)).?].?; + try testing.expect(made.file.?.output.?.from == .search); +} |
