summaryrefslogtreecommitdiff
path: root/src/tagline.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/tagline.zig')
-rw-r--r--src/tagline.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tagline.zig b/src/tagline.zig
index 92c18510..8b214fa6 100644
--- a/src/tagline.zig
+++ b/src/tagline.zig
@@ -21,6 +21,7 @@ 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";
pub const terminal_pane_tail = " " ++ config.terminal_pane_builtins_str;
+pub const command_pane_tail = " " ++ config.command_pane_builtins_str;
const dirty_marker = " *";
pub const legacy_pane_tail = " Del";
pub const legacy_file_pane_tail = " Save Del";
@@ -109,6 +110,14 @@ pub fn pathPrefix(arena: std.mem.Allocator, pane: *Pane) ![]const u8 {
if (comptime pdf_enabled) if (pane.pdf) |pv|
return std.fmt.allocPrint(arena, "{s} [{d}/{d}]", .{ pv.path, pv.page + 1, pv.page_count });
if (pane.image) |*state| return panes.Image.tagPrefix(arena, state);
+ // A command pane: its directory, the line it runs, and how that went.
+ if (pane.command) |line| {
+ const shown = line[0..@min(line.len, 48)];
+ const more = if (shown.len < line.len) "..." else "";
+ if (!pane.command_done) return std.fmt.allocPrint(arena, "{s} ({s}{s}) running", .{ pane.cwdSlice(), shown, more });
+ if (pane.command_status) |n| return std.fmt.allocPrint(arena, "{s} ({s}{s}) exit {d}", .{ pane.cwdSlice(), shown, more, n });
+ return std.fmt.allocPrint(arena, "{s} ({s}{s}) exit ?", .{ pane.cwdSlice(), shown, more });
+ }
if (pane.file) |f| {
const name = if (pane.prompt == .name) pane.input.own orelse f.path else f.path;
if (panes.Output.fileTraits(f.output).saves and f.revision != f.saved_revision)
@@ -148,6 +157,7 @@ pub fn defaultTail(pane: *const Pane) []const u8 {
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.command != null) return command_pane_tail;
if (pane.isTerminal()) return terminal_pane_tail;
return pane_tail;
}