Merge branch 'master' of github.com:tmux/tmux

This commit is contained in:
Nicholas Marriott 2017-08-29 11:13:54 +01:00
commit 91d6bff8b8
7 changed files with 60 additions and 53 deletions

View File

@ -509,7 +509,7 @@ cmd_find_get_pane(struct cmd_find_state *fs, const char *pane, int only)
/* Check for pane ids starting with %. */
if (*pane == '%') {
fs->wp = window_pane_find_by_id_str(pane);
if (fs->wp == NULL || window_pane_outside(fs->wp))
if (fs->wp == NULL)
return (-1);
fs->w = fs->wp->window;
return (cmd_find_best_session_with_window(fs));
@ -546,7 +546,7 @@ cmd_find_get_pane_with_session(struct cmd_find_state *fs, const char *pane)
/* Check for pane ids starting with %. */
if (*pane == '%') {
fs->wp = window_pane_find_by_id_str(pane);
if (fs->wp == NULL || window_pane_outside(fs->wp))
if (fs->wp == NULL)
return (-1);
fs->w = fs->wp->window;
return (cmd_find_best_winlink_with_window(fs));
@ -578,7 +578,7 @@ cmd_find_get_pane_with_window(struct cmd_find_state *fs, const char *pane)
/* Check for pane ids starting with %. */
if (*pane == '%') {
fs->wp = window_pane_find_by_id_str(pane);
if (fs->wp == NULL || window_pane_outside(fs->wp))
if (fs->wp == NULL)
return (-1);
if (fs->wp->window != fs->w)
return (-1);
@ -590,27 +590,27 @@ cmd_find_get_pane_with_window(struct cmd_find_state *fs, const char *pane)
if (fs->w->last == NULL)
return (-1);
fs->wp = fs->w->last;
if (fs->wp == NULL || window_pane_outside(fs->wp))
if (fs->wp == NULL)
return (-1);
return (0);
} else if (strcmp(pane, "{up-of}") == 0) {
fs->wp = window_pane_find_up(fs->w->active);
if (fs->wp == NULL || window_pane_outside(fs->wp))
if (fs->wp == NULL)
return (-1);
return (0);
} else if (strcmp(pane, "{down-of}") == 0) {
fs->wp = window_pane_find_down(fs->w->active);
if (fs->wp == NULL || window_pane_outside(fs->wp))
if (fs->wp == NULL)
return (-1);
return (0);
} else if (strcmp(pane, "{left-of}") == 0) {
fs->wp = window_pane_find_left(fs->w->active);
if (fs->wp == NULL || window_pane_outside(fs->wp))
if (fs->wp == NULL)
return (-1);
return (0);
} else if (strcmp(pane, "{right-of}") == 0) {
fs->wp = window_pane_find_right(fs->w->active);
if (fs->wp == NULL || window_pane_outside(fs->wp))
if (fs->wp == NULL)
return (-1);
return (0);
}
@ -626,7 +626,7 @@ cmd_find_get_pane_with_window(struct cmd_find_state *fs, const char *pane)
fs->wp = window_pane_next_by_number(fs->w, wp, n);
else
fs->wp = window_pane_previous_by_number(fs->w, wp, n);
if (fs->wp != NULL && !window_pane_outside(fs->wp))
if (fs->wp != NULL)
return (0);
}
@ -634,13 +634,13 @@ cmd_find_get_pane_with_window(struct cmd_find_state *fs, const char *pane)
idx = strtonum(pane, 0, INT_MAX, &errstr);
if (errstr == NULL) {
fs->wp = window_pane_at_index(fs->w, idx);
if (fs->wp != NULL && !window_pane_outside(fs->wp))
if (fs->wp != NULL)
return (0);
}
/* Try as a description. */
fs->wp = window_find_string(fs->w, pane);
if (fs->wp != NULL && !window_pane_outside(fs->wp))
if (fs->wp != NULL)
return (0);
return (-1);
@ -688,9 +688,7 @@ cmd_find_valid_state(struct cmd_find_state *fs)
if (fs->w != fs->wl->window)
return (0);
if (!window_has_pane(fs->w, fs->wp))
return (0);
return (!window_pane_outside(fs->wp));
return (window_has_pane(fs->w, fs->wp));
}
/* Copy a state. */
@ -817,10 +815,6 @@ cmd_find_from_pane(struct cmd_find_state *fs, struct window_pane *wp)
{
if (cmd_find_from_window(fs, wp->window) != 0)
return (-1);
if (window_pane_outside(wp)) {
cmd_find_clear_state(fs, 0);
return (-1);
}
fs->wp = wp;
cmd_find_log_state(__func__, fs);
@ -1015,7 +1009,7 @@ cmd_find_target(struct cmd_find_state *fs, struct cmdq_item *item,
switch (type) {
case CMD_FIND_PANE:
fs->wp = cmd_mouse_pane(m, &fs->s, &fs->wl);
if (fs->wp != NULL && !window_pane_outside(fs->wp))
if (fs->wp != NULL)
fs->w = fs->wl->window;
break;
case CMD_FIND_WINDOW:

View File

@ -870,6 +870,15 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
case 'v':
mtd->preview = !mtd->preview;
mode_tree_build(mtd);
/*
* If the current line would now be off screen now the preview
* is on, reset the the offset to the last visible line.
*/
if (mtd->preview && mtd->current > mtd->height - 1) {
mtd->offset = mtd->current - mtd->height;
mtd->current--;
}
break;
}
return (0);

View File

@ -159,6 +159,8 @@ recalculate_sizes(void)
if (w->active == wp)
break;
}
if (w->active == w->last)
w->last = NULL;
server_redraw_window(w);
notify_window("window-layout-changed", w);

3
tmux.h
View File

@ -365,6 +365,7 @@ enum tty_code_code {
TTYC_KIC6,
TTYC_KIC7,
TTYC_KICH1,
TTYC_KIND,
TTYC_KLFT2,
TTYC_KLFT3,
TTYC_KLFT4,
@ -386,6 +387,7 @@ enum tty_code_code {
TTYC_KPRV5,
TTYC_KPRV6,
TTYC_KPRV7,
TTYC_KRI,
TTYC_KRIT2,
TTYC_KRIT3,
TTYC_KRIT4,
@ -2164,7 +2166,6 @@ int window_pane_set_mode(struct window_pane *,
void window_pane_reset_mode(struct window_pane *);
void window_pane_key(struct window_pane *, struct client *,
struct session *, key_code, struct mouse_event *);
int window_pane_outside(struct window_pane *);
int window_pane_visible(struct window_pane *);
u_int window_pane_search(struct window_pane *, const char *);
const char *window_printable_flags(struct winlink *);

View File

@ -271,6 +271,7 @@ static const struct tty_default_key_code tty_default_code_keys[] = {
{ TTYC_KDC5, KEYC_DC|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KDC6, KEYC_DC|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KDC7, KEYC_DC|KEYC_ESCAPE|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KIND, KEYC_UP|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KDN2, KEYC_DOWN|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KDN3, KEYC_DOWN|KEYC_ESCAPE|KEYC_XTERM },
{ TTYC_KDN4, KEYC_DOWN|KEYC_SHIFT|KEYC_ESCAPE|KEYC_XTERM },
@ -319,6 +320,7 @@ static const struct tty_default_key_code tty_default_code_keys[] = {
{ TTYC_KRIT5, KEYC_RIGHT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KRIT6, KEYC_RIGHT|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KRIT7, KEYC_RIGHT|KEYC_ESCAPE|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KRI, KEYC_UP|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KUP2, KEYC_UP|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KUP3, KEYC_UP|KEYC_ESCAPE|KEYC_XTERM },
{ TTYC_KUP4, KEYC_UP|KEYC_SHIFT|KEYC_ESCAPE|KEYC_XTERM },

View File

@ -68,36 +68,36 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_CNORM] = { TTYCODE_STRING, "cnorm" },
[TTYC_COLORS] = { TTYCODE_NUMBER, "colors" },
[TTYC_CR] = { TTYCODE_STRING, "Cr" },
[TTYC_CS] = { TTYCODE_STRING, "Cs" },
[TTYC_CSR] = { TTYCODE_STRING, "csr" },
[TTYC_CUB] = { TTYCODE_STRING, "cub" },
[TTYC_CS] = { TTYCODE_STRING, "Cs" },
[TTYC_CUB1] = { TTYCODE_STRING, "cub1" },
[TTYC_CUD] = { TTYCODE_STRING, "cud" },
[TTYC_CUB] = { TTYCODE_STRING, "cub" },
[TTYC_CUD1] = { TTYCODE_STRING, "cud1" },
[TTYC_CUF] = { TTYCODE_STRING, "cuf" },
[TTYC_CUD] = { TTYCODE_STRING, "cud" },
[TTYC_CUF1] = { TTYCODE_STRING, "cuf1" },
[TTYC_CUF] = { TTYCODE_STRING, "cuf" },
[TTYC_CUP] = { TTYCODE_STRING, "cup" },
[TTYC_CUU] = { TTYCODE_STRING, "cuu" },
[TTYC_CUU1] = { TTYCODE_STRING, "cuu1" },
[TTYC_CUU] = { TTYCODE_STRING, "cuu" },
[TTYC_CVVIS] = { TTYCODE_STRING, "cvvis" },
[TTYC_DCH] = { TTYCODE_STRING, "dch" },
[TTYC_DCH1] = { TTYCODE_STRING, "dch1" },
[TTYC_DCH] = { TTYCODE_STRING, "dch" },
[TTYC_DIM] = { TTYCODE_STRING, "dim" },
[TTYC_DL] = { TTYCODE_STRING, "dl" },
[TTYC_DL1] = { TTYCODE_STRING, "dl1" },
[TTYC_DL] = { TTYCODE_STRING, "dl" },
[TTYC_E3] = { TTYCODE_STRING, "E3" },
[TTYC_ECH] = { TTYCODE_STRING, "ech" },
[TTYC_ED] = { TTYCODE_STRING, "ed" },
[TTYC_EL] = { TTYCODE_STRING, "el" },
[TTYC_EL1] = { TTYCODE_STRING, "el1" },
[TTYC_EL] = { TTYCODE_STRING, "el" },
[TTYC_ENACS] = { TTYCODE_STRING, "enacs" },
[TTYC_FSL] = { TTYCODE_STRING, "fsl" },
[TTYC_HOME] = { TTYCODE_STRING, "home" },
[TTYC_HPA] = { TTYCODE_STRING, "hpa" },
[TTYC_ICH] = { TTYCODE_STRING, "ich" },
[TTYC_ICH1] = { TTYCODE_STRING, "ich1" },
[TTYC_IL] = { TTYCODE_STRING, "il" },
[TTYC_ICH] = { TTYCODE_STRING, "ich" },
[TTYC_IL1] = { TTYCODE_STRING, "il1" },
[TTYC_IL] = { TTYCODE_STRING, "il" },
[TTYC_INDN] = { TTYCODE_STRING, "indn" },
[TTYC_INVIS] = { TTYCODE_STRING, "invis" },
[TTYC_KCBT] = { TTYCODE_STRING, "kcbt" },
@ -112,20 +112,19 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_KDC6] = { TTYCODE_STRING, "kDC6" },
[TTYC_KDC7] = { TTYCODE_STRING, "kDC7" },
[TTYC_KDCH1] = { TTYCODE_STRING, "kdch1" },
[TTYC_KDN2] = { TTYCODE_STRING, "kDN" },
[TTYC_KDN2] = { TTYCODE_STRING, "kDN" }, /* not kDN2 */
[TTYC_KDN3] = { TTYCODE_STRING, "kDN3" },
[TTYC_KDN4] = { TTYCODE_STRING, "kDN4" },
[TTYC_KDN5] = { TTYCODE_STRING, "kDN5" },
[TTYC_KDN6] = { TTYCODE_STRING, "kDN6" },
[TTYC_KDN7] = { TTYCODE_STRING, "kDN7" },
[TTYC_KEND] = { TTYCODE_STRING, "kend" },
[TTYC_KEND2] = { TTYCODE_STRING, "kEND" },
[TTYC_KEND3] = { TTYCODE_STRING, "kEND3" },
[TTYC_KEND4] = { TTYCODE_STRING, "kEND4" },
[TTYC_KEND5] = { TTYCODE_STRING, "kEND5" },
[TTYC_KEND6] = { TTYCODE_STRING, "kEND6" },
[TTYC_KEND7] = { TTYCODE_STRING, "kEND7" },
[TTYC_KF1] = { TTYCODE_STRING, "kf1" },
[TTYC_KEND] = { TTYCODE_STRING, "kend" },
[TTYC_KF10] = { TTYCODE_STRING, "kf10" },
[TTYC_KF11] = { TTYCODE_STRING, "kf11" },
[TTYC_KF12] = { TTYCODE_STRING, "kf12" },
@ -136,7 +135,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_KF17] = { TTYCODE_STRING, "kf17" },
[TTYC_KF18] = { TTYCODE_STRING, "kf18" },
[TTYC_KF19] = { TTYCODE_STRING, "kf19" },
[TTYC_KF2] = { TTYCODE_STRING, "kf2" },
[TTYC_KF1] = { TTYCODE_STRING, "kf1" },
[TTYC_KF20] = { TTYCODE_STRING, "kf20" },
[TTYC_KF21] = { TTYCODE_STRING, "kf21" },
[TTYC_KF22] = { TTYCODE_STRING, "kf22" },
@ -147,7 +146,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_KF27] = { TTYCODE_STRING, "kf27" },
[TTYC_KF28] = { TTYCODE_STRING, "kf28" },
[TTYC_KF29] = { TTYCODE_STRING, "kf29" },
[TTYC_KF3] = { TTYCODE_STRING, "kf3" },
[TTYC_KF2] = { TTYCODE_STRING, "kf2" },
[TTYC_KF30] = { TTYCODE_STRING, "kf30" },
[TTYC_KF31] = { TTYCODE_STRING, "kf31" },
[TTYC_KF32] = { TTYCODE_STRING, "kf32" },
@ -158,7 +157,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_KF37] = { TTYCODE_STRING, "kf37" },
[TTYC_KF38] = { TTYCODE_STRING, "kf38" },
[TTYC_KF39] = { TTYCODE_STRING, "kf39" },
[TTYC_KF4] = { TTYCODE_STRING, "kf4" },
[TTYC_KF3] = { TTYCODE_STRING, "kf3" },
[TTYC_KF40] = { TTYCODE_STRING, "kf40" },
[TTYC_KF41] = { TTYCODE_STRING, "kf41" },
[TTYC_KF42] = { TTYCODE_STRING, "kf42" },
@ -169,7 +168,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_KF47] = { TTYCODE_STRING, "kf47" },
[TTYC_KF48] = { TTYCODE_STRING, "kf48" },
[TTYC_KF49] = { TTYCODE_STRING, "kf49" },
[TTYC_KF5] = { TTYCODE_STRING, "kf5" },
[TTYC_KF4] = { TTYCODE_STRING, "kf4" },
[TTYC_KF50] = { TTYCODE_STRING, "kf50" },
[TTYC_KF51] = { TTYCODE_STRING, "kf51" },
[TTYC_KF52] = { TTYCODE_STRING, "kf52" },
@ -180,11 +179,12 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_KF57] = { TTYCODE_STRING, "kf57" },
[TTYC_KF58] = { TTYCODE_STRING, "kf58" },
[TTYC_KF59] = { TTYCODE_STRING, "kf59" },
[TTYC_KF6] = { TTYCODE_STRING, "kf6" },
[TTYC_KF5] = { TTYCODE_STRING, "kf5" },
[TTYC_KF60] = { TTYCODE_STRING, "kf60" },
[TTYC_KF61] = { TTYCODE_STRING, "kf61" },
[TTYC_KF62] = { TTYCODE_STRING, "kf62" },
[TTYC_KF63] = { TTYCODE_STRING, "kf63" },
[TTYC_KF6] = { TTYCODE_STRING, "kf6" },
[TTYC_KF7] = { TTYCODE_STRING, "kf7" },
[TTYC_KF8] = { TTYCODE_STRING, "kf8" },
[TTYC_KF9] = { TTYCODE_STRING, "kf9" },
@ -202,6 +202,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_KIC6] = { TTYCODE_STRING, "kIC6" },
[TTYC_KIC7] = { TTYCODE_STRING, "kIC7" },
[TTYC_KICH1] = { TTYCODE_STRING, "kich1" },
[TTYC_KIND] = { TTYCODE_STRING, "kind" },
[TTYC_KLFT2] = { TTYCODE_STRING, "kLFT" },
[TTYC_KLFT3] = { TTYCODE_STRING, "kLFT3" },
[TTYC_KLFT4] = { TTYCODE_STRING, "kLFT4" },
@ -229,7 +230,8 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_KRIT5] = { TTYCODE_STRING, "kRIT5" },
[TTYC_KRIT6] = { TTYCODE_STRING, "kRIT6" },
[TTYC_KRIT7] = { TTYCODE_STRING, "kRIT7" },
[TTYC_KUP2] = { TTYCODE_STRING, "kUP" },
[TTYC_KRI] = { TTYCODE_STRING, "kri" },
[TTYC_KUP2] = { TTYCODE_STRING, "kUP" }, /* not kUP2 */
[TTYC_KUP3] = { TTYCODE_STRING, "kUP3" },
[TTYC_KUP4] = { TTYCODE_STRING, "kUP4" },
[TTYC_KUP5] = { TTYCODE_STRING, "kUP5" },
@ -242,11 +244,11 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_RMACS] = { TTYCODE_STRING, "rmacs" },
[TTYC_RMCUP] = { TTYCODE_STRING, "rmcup" },
[TTYC_RMKX] = { TTYCODE_STRING, "rmkx" },
[TTYC_SE] = { TTYCODE_STRING, "Se" },
[TTYC_SETAB] = { TTYCODE_STRING, "setab" },
[TTYC_SETAF] = { TTYCODE_STRING, "setaf" },
[TTYC_SETRGBB] = { TTYCODE_STRING, "setrgbb" },
[TTYC_SETRGBF] = { TTYCODE_STRING, "setrgbf" },
[TTYC_SE] = { TTYCODE_STRING, "Se" },
[TTYC_SGR0] = { TTYCODE_STRING, "sgr0" },
[TTYC_SITM] = { TTYCODE_STRING, "sitm" },
[TTYC_SMACS] = { TTYCODE_STRING, "smacs" },
@ -258,8 +260,8 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_SS] = { TTYCODE_STRING, "Ss" },
[TTYC_TC] = { TTYCODE_FLAG, "Tc" },
[TTYC_TSL] = { TTYCODE_STRING, "tsl" },
[TTYC_VPA] = { TTYCODE_STRING, "vpa" },
[TTYC_U8] = { TTYCODE_NUMBER, "U8" },
[TTYC_VPA] = { TTYCODE_STRING, "vpa" },
[TTYC_XENL] = { TTYCODE_FLAG, "xenl" },
[TTYC_XT] = { TTYCODE_FLAG, "XT" },
};

View File

@ -632,6 +632,8 @@ window_add_pane(struct window *w, struct window_pane *other, int before,
void
window_lost_pane(struct window *w, struct window_pane *wp)
{
log_debug("%s: @%u pane %%%u", __func__, w->id, wp->id);
if (wp == marked_pane.wp)
server_clear_marked();
@ -1292,23 +1294,18 @@ window_pane_key(struct window_pane *wp, struct client *c, struct session *s,
}
int
window_pane_outside(struct window_pane *wp)
window_pane_visible(struct window_pane *wp)
{
struct window *w = wp->window;
if (wp->xoff >= w->sx || wp->yoff >= w->sy)
return (1);
if (wp->xoff + wp->sx > w->sx || wp->yoff + wp->sy > w->sy)
return (1);
return (0);
}
int
window_pane_visible(struct window_pane *wp)
{
if (wp->layout_cell == NULL)
return (0);
return (!window_pane_outside(wp));
if (wp->xoff >= w->sx || wp->yoff >= w->sy)
return (0);
if (wp->xoff + wp->sx > w->sx || wp->yoff + wp->sy > w->sy)
return (0);
return (1);
}
u_int