diff options
author | nicm <nicm> | 2020-04-08 11:26:07 +0000 |
---|---|---|
committer | nicm <nicm> | 2020-04-08 11:26:07 +0000 |
commit | 5d0eb619f18b1ed98d0ecf492dddf66ab49bed03 (patch) | |
tree | e7a35048bcea4bed43f1b3b4e7094908647d09d5 /format.c | |
parent | d388dbdea9ceacacadc27a36ccc968fa7d6070ec (diff) | |
download | rtmux-5d0eb619f18b1ed98d0ecf492dddf66ab49bed03.tar.gz rtmux-5d0eb619f18b1ed98d0ecf492dddf66ab49bed03.tar.bz2 rtmux-5d0eb619f18b1ed98d0ecf492dddf66ab49bed03.zip |
Restore pane_current_path format from portable tmux, it is no longer
used by default and is very useful.
Diffstat (limited to 'format.c')
-rw-r--r-- | format.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -741,6 +741,21 @@ format_cb_current_command(struct format_tree *ft, struct format_entry *fe) free(cmd); } +/* Callback for pane_current_path. */ +static void +format_cb_current_path(struct format_tree *ft, struct format_entry *fe) +{ + struct window_pane *wp = ft->wp; + char *cwd; + + if (wp == NULL) + return; + + cwd = get_proc_cwd(wp->fd); + if (cwd != NULL) + fe->value = xstrdup(cwd); +} + /* Callback for history_bytes. */ static void format_cb_history_bytes(struct format_tree *ft, struct format_entry *fe) @@ -2722,6 +2737,7 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp) format_add(ft, "pane_pid", "%ld", (long) wp->pid); format_add_cb(ft, "pane_start_command", format_cb_start_command); format_add_cb(ft, "pane_current_command", format_cb_current_command); + format_add_cb(ft, "pane_current_path", format_cb_current_path); format_add(ft, "cursor_x", "%u", wp->base.cx); format_add(ft, "cursor_y", "%u", wp->base.cy); |