summaryrefslogtreecommitdiff
path: root/core/look.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/look.zig')
-rw-r--r--core/look.zig10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/look.zig b/core/look.zig
index 2e3d9e57..b240b6e2 100644
--- a/core/look.zig
+++ b/core/look.zig
@@ -738,7 +738,7 @@ pub fn focusPaneLine(p: *Pardes, id: usize, at_in: Spot, landing: enum { center,
if (at_in.line == 0) return;
// A place's line is the file's: past the `Changes` layer's lines.
var at = at_in;
- if (pane.file) |*f| if (f.read_only.len > 0) {
+ if (pane.file) |*f| if (f.layer.lines.len > 0) {
at.line = @intCast(panes.File.bufferRow(f, at.line - 1) + 1);
if (at.end_line != 0) at.end_line = @intCast(panes.File.bufferRow(f, at.end_line - 1) + 1);
};
@@ -1048,6 +1048,12 @@ fn lookUnresolved(p: *Pardes, id: usize, pane: *Pane, trimmed: []const u8, text:
// 9P is no keyboard input, and searches whatever the key mode.
if (pane.addon != null or (pane.body.mode == .tty and !p.fs.serving)) return;
if (text.len == 0) return;
+ // A jj change id (eight of its letters or more, k to z, as jj log
+ // shows them) in a jj repository: its patch (jj.diffChange); one that
+ // names no change is searched for. Look's own, not a plumbing rule: the
+ // rules are read at a session's first look, a file's open among them,
+ // and that rule cost every open (perf: open +8.8k instructions).
+ if (trimmed.len >= 8 and @import("jj.zig").isChangeId(trimmed) and @import("jj.zig").diffChange(p, id, trimmed, false)) return;
if (pane.file != null) return lookWord(p, id, pane, text);
p.word_look = true;
defer p.word_look = false;
@@ -1400,7 +1406,7 @@ fn settleLine(p: *Pardes, id: usize, path: []const u8, at: Spot, before: usize,
const shown = p.panes[p.view().active] orelse return;
const f = if (shown.file) |*file| file else return;
// N is the file's line N (the `Changes` layer's lines have no number).
- if (at.line > panes.File.nlines(p.gpa, f) - f.read_only.len) {
+ if (at.line > panes.File.nlines(p.gpa, f) - f.layer.lines.len) {
if (opened) |free| p.removePane(free, null) catch |err| p.reportError(.at(id), "look", err);
if (p.panes[before] != null) p.view().active = before;
return missedLine(p, id, path, at.line);