summaryrefslogtreecommitdiff
path: root/src/look.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/look.zig')
-rw-r--r--src/look.zig28
1 files changed, 7 insertions, 21 deletions
diff --git a/src/look.zig b/src/look.zig
index 05cdd581..1f81d6ec 100644
--- a/src/look.zig
+++ b/src/look.zig
@@ -1330,8 +1330,7 @@ fn settleLine(p: *Pardes, id: usize, path: []const u8, at: Spot, before: usize,
/// A plain word looked at in a pane, as acme's look3 does with one that
/// names no file (look.c:210, search): its next place in that pane after
-/// the dot, wrapping to the top, is selected there. No +Search pane
-/// (`LookWord list` lists every place in one instead).
+/// the dot, wrapping to the top, is selected there. No +Search pane.
fn lookWord(p: *Pardes, id: usize, pane: *Pane, word: []const u8) void {
const ninep_pane = @import("ninep/pane.zig");
const f = pane.file orelse return;
@@ -1390,7 +1389,7 @@ fn lookUnresolved(p: *Pardes, id: usize, pane: *Pane, trimmed: []const u8, text:
if (pane.image != null or (pane.body.mode == .tty and !p.fs.serving)) return;
if (text.len == 0) return;
if (lookCommit(p, id, pane, trimmed)) return;
- if (p.settings.look_word == .search and pane.file != null) return lookWord(p, id, pane, text);
+ if (pane.file != null) return lookWord(p, id, pane, text);
p.word_look = true;
defer p.word_look = false;
const rows = runSearch(p, id, text, .cursor, false) catch |err| {
@@ -1826,21 +1825,8 @@ pub fn lookAt(p: *Pardes, id: usize, operand_raw: []const u8) void {
var said: [4200]u8 = undefined;
return p.reportFailure(id, std.fmt.bufPrint(&said, "look: {s}: no such directory", .{dir[0..@min(dir.len, 4096)]}) catch "look: no such directory");
};
- // acme's: a pane listing it (Dir.zig). `DirLook terminal`, what
- // pardes did before: `ls` in a terminal there.
- if (p.settings.dir_look == .pane) return panes.Dir.look(p, id, dir);
- for (p.panes, 0..) |slot, i| {
- if (slot) |tt| if (std.mem.eql(u8, tt.cwdSlice(), dir) and exec.takesCommandLine(p, i)) {
- clearNavigationSelection(p, tt);
- p.active = i;
- p.emitWrite(i, "ls\r");
- return;
- };
- }
- const free = p.freeSlot() orelse return p.reportError(id, "look", error.NoPaneSlots);
- const nt = p.newShell(free, dir) catch |err| return p.reportError(id, "look", err);
- nt.greet = true;
- exec.placeNew(p, id, id, free, .shell);
+ // acme's: a pane listing it (Dir.zig).
+ panes.Dir.look(p, id, dir);
},
.file => |target| {
if (comptime pdf_enabled) if (target.kind == .pdf) {
@@ -1872,9 +1858,9 @@ pub fn lookAt(p: *Pardes, id: usize, operand_raw: []const u8) void {
var opened: ?usize = null;
if (!focusPaneByPath(p, target.path, target.at)) {
// A .diff or .patch looked at bare: its hunks stacked in a
- // +Diff (DiffLook hunks), which takes the keyboard as the
- // file would; one with none in it opens as text.
- if (p.settings.diff_look == .hunks and !p.look_text and target.at.line == 0 and
+ // +Diff, which takes the keyboard as the file would; one
+ // with none in it opens as text.
+ if (!p.look_text and target.at.line == 0 and
(std.mem.endsWith(u8, target.path, ".diff") or std.mem.endsWith(u8, target.path, ".patch")))
if (filesystem.read(p, target.path)) |bytes| {
defer p.gpa.free(bytes);