summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-08-28 12:36:39 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-08-28 12:36:39 +0000
commitb0e14fcdec2a87e794e9350e0446bf15e7733b5e (patch)
tree460ed71a63f7db1c8f58333db66eea1c61f38ec8 /usr.bin
parent2a062b8cf666505b08804063bbb0d19c6c20318d (diff)
Do not forbid targets to specify non-visible panes - the checks for
visibility are better where the target is used. GitHub issue 1049.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/cmd-find.c34
-rw-r--r--usr.bin/tmux/resize.c4
-rw-r--r--usr.bin/tmux/tmux.h3
-rw-r--r--usr.bin/tmux/window.c21
4 files changed, 27 insertions, 35 deletions
diff --git a/usr.bin/tmux/cmd-find.c b/usr.bin/tmux/cmd-find.c
index 57999483718..e01ffc61d07 100644
--- a/usr.bin/tmux/cmd-find.c
+++ b/usr.bin/tmux/cmd-find.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-find.c,v 1.55 2017/07/07 07:13:14 nicm Exp $ */
+/* $OpenBSD: cmd-find.c,v 1.56 2017/08/28 12:36:38 nicm Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -510,7 +510,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));
@@ -547,7 +547,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));
@@ -579,7 +579,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);
@@ -591,27 +591,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);
}
@@ -627,7 +627,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);
}
@@ -635,13 +635,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);
@@ -689,9 +689,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. */
@@ -818,10 +816,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);
@@ -1016,7 +1010,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:
diff --git a/usr.bin/tmux/resize.c b/usr.bin/tmux/resize.c
index b67005d2263..b40b0e9fd87 100644
--- a/usr.bin/tmux/resize.c
+++ b/usr.bin/tmux/resize.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resize.c,v 1.23 2017/05/10 16:48:36 nicm Exp $ */
+/* $OpenBSD: resize.c,v 1.24 2017/08/28 12:36:38 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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);
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 34affdb6bdd..03a55aa811e 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.801 2017/08/27 08:33:55 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.802 2017/08/28 12:36:38 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -2162,7 +2162,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 *);
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index c927e84f436..37e163a3b9a 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.204 2017/07/14 18:49:07 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.205 2017/08/28 12:36:38 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -634,6 +634,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();
@@ -1279,23 +1281,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->layout_cell == NULL)
+ return (0);
+
if (wp->xoff >= w->sx || wp->yoff >= w->sy)
- return (1);
+ return (0);
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));
+ return (1);
}
u_int