diff options
Diffstat (limited to 'src/look.zig')
| -rw-r--r-- | src/look.zig | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/look.zig b/src/look.zig index 5cf26240..79cbd50d 100644 --- a/src/look.zig +++ b/src/look.zig @@ -49,6 +49,7 @@ pub fn openLink(url: []const u8) void { if (pid < 0) return; if (pid == 0) { if (fork() == 0) { + @import("host_io.zig").resetChildSignals(); const argv: [3:null]?[*:0]const u8 = .{ opener, url_z.ptr, null }; _ = execv(opener, &argv); } @@ -1414,13 +1415,21 @@ pub fn reopenAt(p: *Pardes, from: usize, path: []const u8, at: Spot) void { } clearNavigationSelection(p, pane); focusPaneLine(p, id, to, .center); + // Said when the file no longer has the line, closed or open: the place + // is its last line now. + if (at.line > n or at.end_line > n) { + var said: [miss_path_cap + 64]u8 = undefined; + var cut: [miss_path_cap + "…".len]u8 = undefined; + p.setMessage(id, std.fmt.bufPrint(&said, "{s} has {d} lines now: at its last", .{ missText(path, &cut), n }) catch "at its last line"); + } } -/// Whether `pane` is the +Recent list, whose rows are remembered places. +/// Whether `pane` is the +Recent or the Jumplist list, whose rows are +/// remembered places: a look at one clamps to the file as it is now. fn isRecentList(pane: *const Pane) bool { const f = pane.file orelse return false; const o = f.output orelse return false; - return std.meta.eql(o.from, panes.Output.Origin{ .cmd = .Recent }); + return std.meta.eql(o.from, panes.Output.Origin{ .cmd = .Recent }) or std.meta.eql(o.from, panes.Output.Origin{ .cmd = .Jumplist }); } pub fn lookAt(p: *Pardes, id: usize, operand: []const u8) void { @@ -1539,8 +1548,12 @@ pub fn lookAt(p: *Pardes, id: usize, operand: []const u8) void { if (comptime pdf_enabled) if (target.kind == .pdf) { if (focusPaneByPath(p, target.path, target.at)) return; const free = p.freeSlot() orelse return p.reportError(id, "look", error.NoPaneSlots); - _ = panes.Pdf.openPane(p, free, target.path, target.at.line) catch |err| - return p.reportError(id, "look", err); + // Said with its path and why, as an image that cannot be read is. + _ = panes.Pdf.openPane(p, free, target.path, target.at.line) catch |err| { + var said: [miss_path_cap + 64]u8 = undefined; + var cut: [miss_path_cap + "…".len]u8 = undefined; + return p.reportError(id, std.fmt.bufPrint(&said, "look: {s}: not a PDF pardes can read", .{missText(target.path, &cut)}) catch "look: not a PDF pardes can read", err); + }; exec.placeNew(p, id, id, free, .doc); return; }; |
