Merge branch 'obsd-master'

Conflicts:
	format.c
This commit is contained in:
Thomas Adam 2014-12-19 19:20:09 +00:00
commit 5f8138faf5
6 changed files with 33 additions and 3 deletions

View File

@ -18,6 +18,7 @@
#include <sys/types.h>
#include <sys/param.h>
#include <sys/wait.h>
#include <ctype.h>
#include <errno.h>
@ -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);

View File

@ -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;
}

1
tmux.1
View File

@ -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"

1
tmux.h
View File

@ -888,6 +888,7 @@ struct window_pane {
pid_t pid;
char tty[TTY_NAME_MAX];
int status;
u_int changes;
struct event changes_timer;

View File

@ -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)
{

View File

@ -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);
}