diff options
Diffstat (limited to 'core/look.zig')
| -rw-r--r-- | core/look.zig | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/core/look.zig b/core/look.zig index f9dcfbc3..41c59cf3 100644 --- a/core/look.zig +++ b/core/look.zig @@ -433,12 +433,15 @@ pub fn runSearch(p: *Pardes, id: usize, pat_raw: []const u8, start: SearchStart, // a builtin's argument comes trimmed already. const pat = std.mem.trimEnd(u8, pat_raw, "\r\n"); if (std.mem.trim(u8, pat, " \t").len == 0) return 0; - const arena = p.scratch.allocator(); // where the pane lives: a file's directory, a shell's cwd — the // directory the results buffer is named in. From a column's or the // workspace's tag, the session's. const dir = if (p.exec_header) p.sessionDir() else Pardes.paneDir(pane); - const out = try @import("memory.zig").unfilled(arena, search_text_output_bytes); + // The gpa's, not the step's arena: 9P requests come between steps, + // and a word looked at twice in one burst of them asked that arena for + // a node of 75 MB (core/fuzz.zig's 9P seed 610). + const out = try @import("memory.zig").unfilled(p.gpa, search_text_output_bytes); + defer p.gpa.free(out); var out_len: usize = 0; var nrows: usize = 0; var anchor: ?usize = null; @@ -1514,7 +1517,8 @@ pub const Landed = union(enum) { none, shown, opened: usize }; /// SPEC §6.1). With `Jumps walk`: a held pane showing the file is focused /// and nothing replaced; the asking pane showing it moves in it (a step /// when it is reading); a reading pane steps in place, a held one steps -/// its reader (Trail.zig), made under it on its first jump. With +/// its reader (Trail.zig), made on its first jump in free space or under +/// it (layout.placeNew), an untouched pane's in its place. With /// `Jumps new-pane` as before the walk: a pane showing the file focused, /// else a new one. pub fn open(p: *Pardes, from: usize, path: []const u8, at: Spot, how: How) Landed { @@ -1568,8 +1572,12 @@ fn openNew(p: *Pardes, from: usize, path: []const u8, at: Spot, kind: layout.New }; nt.body.cur_col = columnOn(nt, nt.body.cur_row, at.col); // A reader's walk (its owner's word, its place) is in its tag before - // it is placed: the rows it is given are for the tag it shows. - if (kind == .reader) nt.trail = Trail.reader(p.panes[from].?.serial, path, at); + // it is placed: the rows it is given are for the tag it shows. From an + // untouched pane, whose place it takes (UX J1), its place alone. + if (kind == .reader) { + const asker = p.panes[from].?; + nt.trail = Trail.reader(if (Trail.untouched(p, asker)) null else asker.serial, path, at); + } const failures = p.fs.failures; layout.placeNew(p, from, from, free, kind); // Refused a place: that is the look's one failure, not a miss of its |
