diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-15 14:22:42 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-09-15 17:24:42 -0300 |
| commit | ac097fc86d710cdc8e83804b00663ac787f8b383 (patch) | |
| tree | 1a94a9973254b8ac1e3bcc625e819dee9552a955 | |
| parent | 6d7b506c8a380e4dd97f337590ca079d810a360a (diff) | |
| download | pardes-ac097fc86d710cdc8e83804b00663ac787f8b383.tar.gz pardes-ac097fc86d710cdc8e83804b00663ac787f8b383.zip | |
Expose LocationsConfig in location result pane tags
| -rw-r--r-- | docs/config.md | 3 | ||||
| -rw-r--r-- | src/panes.zig | 13 | ||||
| -rw-r--r-- | src/pardes.zig | 16 |
3 files changed, 24 insertions, 8 deletions
diff --git a/docs/config.md b/docs/config.md index 899d4cc4..854b3140 100644 --- a/docs/config.md +++ b/docs/config.md @@ -128,6 +128,9 @@ scrolling; scrolling upward reveals that source line as the headers recede. `Dump` and `Restore` preserve the setting per pane. Customized tags retain their text; the command can still be executed from any source pane. +Search, Grep and LSP location-result panes include `LocationsConfig` in their +default tags. Custom tags keep their edits. + `LocationsConfig` prints the current settings for Search, Grep and LSP location results in an output pane. Execute the printed line to apply it again, or supply just the fields to change: diff --git a/src/panes.zig b/src/panes.zig index a66d8e21..ede1d661 100644 --- a/src/panes.zig +++ b/src/panes.zig @@ -2265,6 +2265,13 @@ pub const Output = struct { }; } + pub fn usesLocationsConfig(from: Origin) bool { + const tr = traits(from); + return tr.steps and !tr.commands and from != .pdf_links and + !std.meta.eql(from, Origin{ .cmd = .Find }) and + !std.meta.eql(from, Origin{ .query = .completion }); + } + pub fn fileTraits(out: ?State) Traits { return traits((out orelse return file_row).from); } @@ -2480,11 +2487,7 @@ pub const Output = struct { return; } } - const format_locations = traits(from).steps and !traits(from).commands and - from != .pdf_links and - !std.meta.eql(from, Origin{ .cmd = .Find }) and - !std.meta.eql(from, Origin{ .query = .completion }); - if (format_locations) { + if (usesLocationsConfig(from)) { const formatted = try locations.format(p, dir, content, anchor, true); p.gpa.free(result_content); result_content = formatted.content; diff --git a/src/pardes.zig b/src/pardes.zig index 6e88974d..cd62eb3b 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -259,6 +259,7 @@ const pane_tail = " " ++ config.pane_builtins_str; const pdf_pane_tail = " " ++ config.pdf_pane_builtins_str; const file_pane_tail = " " ++ config.file_pane_builtins_str; const context_pane_tail = file_pane_tail ++ " TreeContext"; +const locations_pane_tail = file_pane_tail ++ " LocationsConfig"; const terminal_pane_tail = " " ++ config.terminal_pane_builtins_str; const dirty_marker = " *"; const legacy_pane_tail = " Del"; @@ -7082,6 +7083,8 @@ pub const Pardes = struct { fn defaultTail(pane: *const Pane) []const u8 { if (comptime pdf_enabled) if (pane.pdf != null) return pdf_pane_tail; + if (pane.file) |file| if (file.output) |out| + if (panes.Output.usesLocationsConfig(out.from)) return locations_pane_tail; if (panes.File.supportsContext(pane)) return context_pane_tail; if (pane.file != null) return file_pane_tail; if (pane.isTerminal()) return terminal_pane_tail; @@ -12444,9 +12447,16 @@ pub const Pardes = struct { .generic => &.{ pdf_pane_tail, pane_tail, pre_collapse_pdf_pane_tail, pre_collapse_pane_tail, pre_column_pdf_pane_tail, pre_column_pane_tail, prev_pane_tail, legacy_pane_tail }, .file => &.{ context_pane_tail, file_pane_tail, pre_collapse_file_pane_tail, pre_column_file_pane_tail, prev_file_pane_tail, legacy_file_pane_tail }, .output => &.{ - file_pane_tail, prev_file_pane_tail, legacy_file_pane_tail, - pane_tail, prev_pane_tail, legacy_pane_tail, - pre_column_file_pane_tail, pre_column_pane_tail, pre_collapse_file_pane_tail, + locations_pane_tail, + file_pane_tail, + prev_file_pane_tail, + legacy_file_pane_tail, + pane_tail, + prev_pane_tail, + legacy_pane_tail, + pre_column_file_pane_tail, + pre_column_pane_tail, + pre_collapse_file_pane_tail, pre_collapse_pane_tail, }, .terminal => &.{ terminal_pane_tail, pre_collapse_terminal_pane_tail, pre_column_terminal_pane_tail, pre_tty_terminal_pane_tail, prev_terminal_pane_tail, legacy_terminal_pane_tail, pane_tail, pre_collapse_pane_tail, pre_column_pane_tail, prev_pane_tail, legacy_pane_tail }, |
