summaryrefslogtreecommitdiff
path: root/src/tagline.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-08 12:03:46 -0300
committerGabriel Schneider <[email protected]>2026-10-22 10:03:15 -0300
commit1ecb9b720840ea8e4753823fa8cddcf5d6a3a4d2 (patch)
tree973976c63f560201638d453b4b8b277d9cb40040 /src/tagline.zig
parent13d5613b77c62c425c3a124a34c0c2528cc6251f (diff)
downloadpardes-1ecb9b720840ea8e4753823fa8cddcf5d6a3a4d2.tar.gz
pardes-1ecb9b720840ea8e4753823fa8cddcf5d6a3a4d2.zip
Add a readable static Callstack pane and align tagline text
Diffstat (limited to 'src/tagline.zig')
-rw-r--r--src/tagline.zig19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/tagline.zig b/src/tagline.zig
index cf0b17fd..b6601d61 100644
--- a/src/tagline.zig
+++ b/src/tagline.zig
@@ -19,15 +19,19 @@ const Pardes = pardes.Pardes;
pub const pane_tail = " " ++ config.pane_builtins_str;
pub const pdf_pane_tail = " " ++ config.pdf_pane_builtins_str;
pub const file_pane_tail = " " ++ config.file_pane_builtins_str;
-pub const context_pane_tail = file_pane_tail ++ " TreeContext";
-pub const locations_pane_tail = file_pane_tail ++ " LocationsConfig";
-/// A file a language server speaks for (by its extension): its jumps too.
-pub const lsp_pane_tail = file_pane_tail ++ " " ++ config.lsp_pane_builtins_str;
-pub const lsp_context_pane_tail = context_pane_tail ++ " " ++ config.lsp_pane_builtins_str;
+fn withFileCommands(comptime tail: []const u8, comptime words: []const u8) []const u8 {
+ std.debug.assert(std.mem.endsWith(u8, tail, " Del"));
+ return tail[0 .. tail.len - " Del".len] ++ " " ++ words ++ " Del";
+}
+pub const context_pane_tail = withFileCommands(file_pane_tail, "TreeContext");
+pub const locations_pane_tail = withFileCommands(file_pane_tail, "LocationsConfig");
+/// Language commands precede the final Del, like other file-pane commands.
+pub const lsp_pane_tail = withFileCommands(file_pane_tail, config.lsp_pane_builtins_str);
+pub const lsp_context_pane_tail = withFileCommands(context_pane_tail, config.lsp_pane_builtins_str);
pub const pager_pane_tail = " " ++ config.pager_pane_builtins_str;
pub const diff_pane_tail = " " ++ config.diff_pane_builtins_str;
pub const pager_diff_pane_tail = " " ++ config.pager_diff_pane_builtins_str;
-pub const diff_view_tail = " " ++ config.diff_view_builtins_str ++ " LocationsConfig";
+pub const diff_view_tail = withFileCommands(" " ++ config.diff_view_builtins_str, "LocationsConfig");
pub const terminal_pane_tail = " " ++ config.terminal_pane_builtins_str;
pub const command_pane_tail = " " ++ config.command_pane_builtins_str;
pub const dir_pane_tail = " " ++ config.dir_pane_builtins_str;
@@ -76,7 +80,7 @@ pub fn revealHeader(p: *Pardes) void {
if (cur < p.header_top) p.header_top = cur;
if (rows > 0 and cur >= p.header_top + rows) p.header_top = cur + 1 - rows;
const line = modal.lineSlice(text, cur);
- const width = p.tagCapacity(if (p.header_column) |c| p.col_w[c] -| TAG_TEXT_INSET else p.screen_w);
+ const width = p.tagCapacity(if (p.header_column) |c| p.col_w[c] -| TAG_TEXT_INSET else p.screen_w -| TAG_TEXT_INSET);
const col = panes.File.rawDisplayCol(line, @min(@as(usize, @intCast(@max(0, t.cur_col))), line.len));
if (col < p.header_scroll) p.header_scroll = col;
if (col >= p.header_scroll + width) p.header_scroll = col -| (width -| 1);
@@ -480,4 +484,3 @@ test "a pane tag wraps a long line onto rows, and offsets map both ways" {
try std.testing.expectEqual(@as(usize, 10), shown.toReal(11)); // the 'e' of Del
try std.testing.expectEqual(@as(usize, 11), shown.fromReal(10));
}
-