summaryrefslogtreecommitdiffstats
path: root/window.c
diff options
context:
space:
mode:
authornicm <nicm>2016-11-16 00:24:03 +0000
committernicm <nicm>2016-11-16 00:24:03 +0000
commite88b74350fba9e35307f35a8645b23e3cde9200a (patch)
tree7e97f502b883765b11e70ef6425d95371fa2046c /window.c
parentc34a79b152e1d27ed87417e6a940358990ab9e79 (diff)
The target validity check used window_pane_visible but that may be false
if the pane is zoomed, so instead add a new function to just check if the pane is actually on screen (most commands still want to accept panes invisible by zoom). Also reject panes outside the window for various special targets. Problem reported by Sean Haugh.
Diffstat (limited to 'window.c')
-rw-r--r--window.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/window.c b/window.c
index 56878a19..16929deb 100644
--- a/window.c
+++ b/window.c
@@ -1185,17 +1185,23 @@ window_pane_key(struct window_pane *wp, struct client *c, struct session *s,
}
int
-window_pane_visible(struct window_pane *wp)
+window_pane_outside(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 (0);
+ 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 (1);
+ return (!window_pane_outside(wp));
}
char *