diff --git a/format.c b/format.c index fff9a695..80bcc467 100644 --- a/format.c +++ b/format.c @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -582,6 +583,7 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp) unsigned long long size; u_int i, idx; char *cmd, *cwd; + int status; if (ft->w == NULL) ft->w = wp->window; @@ -605,9 +607,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 d58c8f38..9b11e019 100644 --- a/server.c +++ b/server.c @@ -442,6 +442,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 726f23a1..13460760 100644 --- a/tmux.1 +++ b/tmux.1 @@ -3122,6 +3122,7 @@ The following variables are available, where appropriate: .It Li "pane_current_command" Ta "" Ta "Current command if available" .It Li "pane_current_path" Ta "" Ta "Current path 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 61f2ca7c..8fbda560 100644 --- a/tmux.h +++ b/tmux.h @@ -888,6 +888,7 @@ struct window_pane { pid_t pid; char tty[TTY_NAME_MAX]; + int status; u_int changes; struct event changes_timer; 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) { diff --git a/window.c b/window.c index 4d8cd1c5..54129634 100644 --- a/window.c +++ b/window.c @@ -490,6 +490,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); } @@ -511,6 +512,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); }