From 7a0c94b28ab96d32dcbd98cfad54662f67875332 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 9 Dec 2014 19:23:35 +0000 Subject: [PATCH 1/3] Add pane_dead_status for exit status of dead panes. --- format.c | 8 +++++++- server.c | 1 + tmux.1 | 1 + tmux.h | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/format.c b/format.c index 87d6cd41..c5ede2bd 100644 --- a/format.c +++ b/format.c @@ -17,6 +17,7 @@ */ #include +#include #include #include @@ -581,6 +582,7 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp) unsigned long long size; u_int i, idx; char *cmd; + int status; if (ft->w == NULL) ft->w = wp->window; @@ -604,9 +606,13 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp) format_add(ft, "pane_title", "%s", wp->base.title); format_add(ft, "pane_id", "%%%u", wp->id); format_add(ft, "pane_active", "%d", wp == wp->window->active); - format_add(ft, "pane_dead", "%d", wp->fd == -1); format_add(ft, "pane_input_off", "%d", !!(wp->flags & PANE_INPUTOFF)); + status = wp->status; + if (wp->fd == -1 && WIFEXITED(status)) + format_add(ft, "pane_dead_status", "%d", WEXITSTATUS(status)); + format_add(ft, "pane_dead", "%d", wp->fd == -1); + if (window_pane_visible(wp)) { format_add(ft, "pane_left", "%u", wp->xoff); format_add(ft, "pane_top", "%u", wp->yoff); diff --git a/server.c b/server.c index db261306..26bfddfe 100644 --- a/server.c +++ b/server.c @@ -441,6 +441,7 @@ server_child_exited(pid_t pid, int status) continue; TAILQ_FOREACH(wp, &w->panes, entry) { if (wp->pid == pid) { + wp->status = status; server_destroy_pane(wp); break; } diff --git a/tmux.1 b/tmux.1 index 63ab82ba..5154adbb 100644 --- a/tmux.1 +++ b/tmux.1 @@ -3117,6 +3117,7 @@ The following variables are available, where appropriate: .It Li "pane_bottom" Ta "" Ta "Bottom of pane" .It Li "pane_current_command" Ta "" Ta "Current command if available" .It Li "pane_dead" Ta "" Ta "1 if pane is dead" +.It Li "pane_dead_status" Ta "" Ta "Exit status of process in dead pane" .It Li "pane_height" Ta "" Ta "Height of pane" .It Li "pane_id" Ta "#D" Ta "Unique pane ID" .It Li "pane_in_mode" Ta "" Ta "If pane is in a mode" diff --git a/tmux.h b/tmux.h index d8cb5da8..aff664c0 100644 --- a/tmux.h +++ b/tmux.h @@ -890,6 +890,7 @@ struct window_pane { pid_t pid; char tty[TTY_NAME_MAX]; + int status; u_int changes; struct event changes_timer; From d88c381ce912dfc48fc2d53ed020bf2016f4b509 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 15 Dec 2014 10:02:55 +0000 Subject: [PATCH 2/3] Only redraw affected lines when selection changes with mouse. From Michael Graczyk. --- window-copy.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/window-copy.c b/window-copy.c index f5973322..8aae09be 100644 --- a/window-copy.c +++ b/window-copy.c @@ -33,6 +33,7 @@ int window_copy_key_numeric_prefix(struct window_pane *, int); void window_copy_mouse(struct window_pane *, struct session *, struct mouse_event *); +void window_copy_redraw_selection(struct window_pane *, u_int); void window_copy_redraw_lines(struct window_pane *, u_int, u_int); void window_copy_redraw_screen(struct window_pane *); void window_copy_write_line(struct window_pane *, struct screen_write_ctx *, @@ -874,7 +875,7 @@ window_copy_mouse(struct window_pane *wp, struct session *sess, { struct window_copy_mode_data *data = wp->modedata; struct screen *s = &data->screen; - u_int i; + u_int i, old_cy; if (m->x >= screen_size_x(s)) return; @@ -907,9 +908,10 @@ window_copy_mouse(struct window_pane *wp, struct session *sess, */ if (s->mode & MODE_MOUSE_BUTTON) { if (~m->event & MOUSE_EVENT_UP) { + old_cy = data->cy; window_copy_update_cursor(wp, m->x, m->y); if (window_copy_update_selection(wp, 1)) - window_copy_redraw_screen(wp); + window_copy_redraw_selection(wp, old_cy); return; } goto reset_mode; @@ -1245,6 +1247,23 @@ window_copy_write_lines(struct window_pane *wp, struct screen_write_ctx *ctx, window_copy_write_line(wp, ctx, py); } +void +window_copy_redraw_selection(struct window_pane *wp, u_int old_y) +{ + struct window_copy_mode_data *data = wp->modedata; + u_int new_y, start, end; + + new_y = data->cy; + if (old_y <= new_y) { + start = old_y; + end = new_y; + } else { + start = new_y; + end = old_y; + } + window_copy_redraw_lines(wp, start, end - start + 1); +} + void window_copy_redraw_lines(struct window_pane *wp, u_int py, u_int ny) { From 160e3e2be3543377925551146403933a7c631f51 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 15 Dec 2014 10:04:18 +0000 Subject: [PATCH 3/3] Notify on zoom/unzoom, from George Nachmann. --- window.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/window.c b/window.c index 0144cdc8..0206c6cc 100644 --- a/window.c +++ b/window.c @@ -491,6 +491,7 @@ window_zoom(struct window_pane *wp) w->saved_layout_root = w->layout_root; layout_init(w, wp); w->flags |= WINDOW_ZOOMED; + notify_window_layout_changed(w); return (0); } @@ -512,6 +513,7 @@ window_unzoom(struct window *w) wp->saved_layout_cell = NULL; } layout_fix_panes(w, w->sx, w->sy); + notify_window_layout_changed(w); return (0); }