summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/look.zig4
-rw-r--r--src/ninep/ctl.zig13
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);
+}