4 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
15 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
16 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 #include <sys/types.h>
20 #include <sys/ioctl.h>
38 * Each window is attached to a number of panes, each of which is a pty. This
39 * file contains code to handle them.
41 * A pane has two buffers attached, these are filled and emptied by the main
42 * server poll loop. Output data is received from pty's in screen format,
43 * translated and returned as a series of escape sequences and strings via
44 * input_parse (in input.c). Input data is received as key codes and written
45 * directly via input_key.
47 * Each pane also has a "virtual" screen (screen.c) which contains the current
48 * state and is redisplayed when the window is reattached to a client.
50 * Windows are stored directly on a global array and wrapped in any number of
51 * winlink structs to be linked onto local session RB trees. A reference count
52 * is maintained and a window removed from the global list and destroyed when
56 /* Global window list. */
57 struct windows windows
;
59 /* Global panes tree. */
60 struct window_pane_tree all_window_panes
;
61 u_int next_window_pane
;
63 void window_pane_read_callback(struct bufferevent
*, void *);
64 void window_pane_error_callback(struct bufferevent
*, short, void *);
66 RB_GENERATE(winlinks
, winlink
, entry
, winlink_cmp
);
69 winlink_cmp(struct winlink
*wl1
, struct winlink
*wl2
)
71 return (wl1
->idx
- wl2
->idx
);
74 RB_GENERATE(window_pane_tree
, window_pane
, tree_entry
, window_pane_cmp
);
77 window_pane_cmp(struct window_pane
*wp1
, struct window_pane
*wp2
)
79 return (wp1
->id
- wp2
->id
);
83 winlink_find_by_window(struct winlinks
*wwl
, struct window
*w
)
87 RB_FOREACH(wl
, winlinks
, wwl
) {
96 winlink_find_by_index(struct winlinks
*wwl
, int idx
)
104 return (RB_FIND(winlinks
, wwl
, &wl
));
108 winlink_next_index(struct winlinks
*wwl
, int idx
)
114 if (winlink_find_by_index(wwl
, i
) == NULL
)
125 winlink_count(struct winlinks
*wwl
)
131 RB_FOREACH(wl
, winlinks
, wwl
)
138 winlink_add(struct winlinks
*wwl
, int idx
)
143 if ((idx
= winlink_next_index(wwl
, -idx
- 1)) == -1)
145 } else if (winlink_find_by_index(wwl
, idx
) != NULL
)
148 wl
= xcalloc(1, sizeof *wl
);
150 RB_INSERT(winlinks
, wwl
, wl
);
156 winlink_set_window(struct winlink
*wl
, struct window
*w
)
163 winlink_remove(struct winlinks
*wwl
, struct winlink
*wl
)
165 struct window
*w
= wl
->window
;
167 RB_REMOVE(winlinks
, wwl
, wl
);
168 if (wl
->status_text
!= NULL
)
169 xfree(wl
->status_text
);
173 if (w
->references
== 0)
174 fatal("bad reference count");
176 if (w
->references
== 0)
182 winlink_next(struct winlink
*wl
)
184 return (RB_NEXT(winlinks
, wwl
, wl
));
188 winlink_previous(struct winlink
*wl
)
190 return (RB_PREV(winlinks
, wwl
, wl
));
194 winlink_next_by_number(struct winlink
*wl
, struct session
*s
, int n
)
197 if ((wl
= RB_NEXT(winlinks
, wwl
, wl
)) == NULL
)
198 wl
= RB_MIN(winlinks
, &s
->windows
);
205 winlink_previous_by_number(struct winlink
*wl
, struct session
*s
, int n
)
208 if ((wl
= RB_PREV(winlinks
, wwl
, wl
)) == NULL
)
209 wl
= RB_MAX(winlinks
, &s
->windows
);
216 winlink_stack_push(struct winlink_stack
*stack
, struct winlink
*wl
)
221 winlink_stack_remove(stack
, wl
);
222 TAILQ_INSERT_HEAD(stack
, wl
, sentry
);
226 winlink_stack_remove(struct winlink_stack
*stack
, struct winlink
*wl
)
233 TAILQ_FOREACH(wl2
, stack
, sentry
) {
235 TAILQ_REMOVE(stack
, wl
, sentry
);
242 window_index(struct window
*s
, u_int
*i
)
244 for (*i
= 0; *i
< ARRAY_LENGTH(&windows
); (*i
)++) {
245 if (s
== ARRAY_ITEM(&windows
, *i
))
252 window_create1(u_int sx
, u_int sy
)
257 w
= xcalloc(1, sizeof *w
);
261 TAILQ_INIT(&w
->panes
);
265 w
->layout_root
= NULL
;
270 queue_window_name(w
);
272 options_init(&w
->options
, &global_w_options
);
274 for (i
= 0; i
< ARRAY_LENGTH(&windows
); i
++) {
275 if (ARRAY_ITEM(&windows
, i
) == NULL
) {
276 ARRAY_SET(&windows
, i
, w
);
280 if (i
== ARRAY_LENGTH(&windows
))
281 ARRAY_ADD(&windows
, w
);
288 window_create(const char *name
, const char *cmd
, const char *shell
,
289 const char *cwd
, struct environ
*env
, struct termios
*tio
,
290 u_int sx
, u_int sy
, u_int hlimit
,char **cause
)
293 struct window_pane
*wp
;
295 w
= window_create1(sx
, sy
);
296 wp
= window_add_pane(w
, hlimit
);
298 if (window_pane_spawn(wp
, cmd
, shell
, cwd
, env
, tio
, cause
) != 0) {
302 w
->active
= TAILQ_FIRST(&w
->panes
);
304 w
->name
= xstrdup(name
);
305 options_set_number(&w
->options
, "automatic-rename", 0);
307 w
->name
= default_window_name(w
);
312 window_destroy(struct window
*w
)
316 if (window_index(w
, &i
) != 0)
317 fatalx("index not found");
318 ARRAY_SET(&windows
, i
, NULL
);
319 while (!ARRAY_EMPTY(&windows
) && ARRAY_LAST(&windows
) == NULL
)
320 ARRAY_TRUNC(&windows
, 1);
322 if (w
->layout_root
!= NULL
)
325 evtimer_del(&w
->name_timer
);
327 options_free(&w
->options
);
329 window_destroy_panes(w
);
337 window_resize(struct window
*w
, u_int sx
, u_int sy
)
344 window_set_active_pane(struct window
*w
, struct window_pane
*wp
)
350 while (!window_pane_visible(w
->active
)) {
351 w
->active
= TAILQ_PREV(w
->active
, window_panes
, entry
);
352 if (w
->active
== NULL
)
353 w
->active
= TAILQ_LAST(&w
->panes
, window_panes
);
360 window_get_active_at(struct window
*w
, u_int x
, u_int y
)
362 struct window_pane
*wp
;
364 TAILQ_FOREACH(wp
, &w
->panes
, entry
) {
365 if (!window_pane_visible(wp
))
367 if (x
< wp
->xoff
|| x
> wp
->xoff
+ wp
->sx
)
369 if (y
< wp
->yoff
|| y
> wp
->yoff
+ wp
->sy
)
377 window_set_active_at(struct window
*w
, u_int x
, u_int y
)
379 struct window_pane
*wp
;
381 wp
= window_get_active_at(w
, x
, y
);
382 if (wp
!= NULL
&& wp
!= w
->active
)
383 window_set_active_pane(w
, wp
);
387 window_find_string(struct window
*w
, const char *s
)
394 if (strcasecmp(s
, "top") == 0)
396 else if (strcasecmp(s
, "bottom") == 0)
398 else if (strcasecmp(s
, "left") == 0)
400 else if (strcasecmp(s
, "right") == 0)
402 else if (strcasecmp(s
, "top-left") == 0) {
405 } else if (strcasecmp(s
, "top-right") == 0) {
408 } else if (strcasecmp(s
, "bottom-left") == 0) {
411 } else if (strcasecmp(s
, "bottom-right") == 0) {
417 return (window_get_active_at(w
, x
, y
));
421 window_add_pane(struct window
*w
, u_int hlimit
)
423 struct window_pane
*wp
;
425 wp
= window_pane_create(w
, w
->sx
, w
->sy
, hlimit
);
426 if (TAILQ_EMPTY(&w
->panes
))
427 TAILQ_INSERT_HEAD(&w
->panes
, wp
, entry
);
429 TAILQ_INSERT_AFTER(&w
->panes
, w
->active
, wp
, entry
);
434 window_remove_pane(struct window
*w
, struct window_pane
*wp
)
436 if (wp
== w
->active
) {
439 if (w
->active
== NULL
) {
440 w
->active
= TAILQ_PREV(wp
, window_panes
, entry
);
441 if (w
->active
== NULL
)
442 w
->active
= TAILQ_NEXT(wp
, entry
);
444 } else if (wp
== w
->last
)
447 TAILQ_REMOVE(&w
->panes
, wp
, entry
);
448 window_pane_destroy(wp
);
452 window_pane_at_index(struct window
*w
, u_int idx
)
454 struct window_pane
*wp
;
458 TAILQ_FOREACH(wp
, &w
->panes
, entry
) {
467 window_pane_next_by_number(struct window
*w
, struct window_pane
*wp
, u_int n
)
470 if ((wp
= TAILQ_NEXT(wp
, entry
)) == NULL
)
471 wp
= TAILQ_FIRST(&w
->panes
);
478 window_pane_previous_by_number(struct window
*w
, struct window_pane
*wp
,
482 if ((wp
= TAILQ_PREV(wp
, window_panes
, entry
)) == NULL
)
483 wp
= TAILQ_LAST(&w
->panes
, window_panes
);
490 window_pane_index(struct window
*w
, struct window_pane
*wp
)
492 struct window_pane
*wq
;
496 TAILQ_FOREACH(wq
, &w
->panes
, entry
) {
505 window_count_panes(struct window
*w
)
507 struct window_pane
*wp
;
511 TAILQ_FOREACH(wp
, &w
->panes
, entry
)
517 window_destroy_panes(struct window
*w
)
519 struct window_pane
*wp
;
521 while (!TAILQ_EMPTY(&w
->panes
)) {
522 wp
= TAILQ_FIRST(&w
->panes
);
523 TAILQ_REMOVE(&w
->panes
, wp
, entry
);
524 window_pane_destroy(wp
);
528 /* Return list of printable window flag symbols. No flags is just a space. */
530 window_printable_flags(struct session
*s
, struct winlink
*wl
)
536 if (wl
->flags
& WINLINK_ACTIVITY
)
538 if (wl
->flags
& WINLINK_BELL
)
540 if (wl
->flags
& WINLINK_CONTENT
)
542 if (wl
->flags
& WINLINK_SILENCE
)
546 if (wl
== TAILQ_FIRST(&s
->lastw
))
551 return (xstrdup(flags
));
554 /* Find pane in global tree by id. */
556 window_pane_find_by_id(u_int id
)
558 struct window_pane wp
;
561 return (RB_FIND(window_pane_tree
, &all_window_panes
, &wp
));
565 window_pane_create(struct window
*w
, u_int sx
, u_int sy
, u_int hlimit
)
567 struct window_pane
*wp
;
569 wp
= xcalloc(1, sizeof *wp
);
572 wp
->id
= next_window_pane
++;
573 RB_INSERT(window_pane_tree
, &all_window_panes
, wp
);
584 wp
->layout_cell
= NULL
;
594 wp
->pipe_event
= NULL
;
596 wp
->saved_grid
= NULL
;
598 screen_init(&wp
->base
, sx
, sy
, hlimit
);
599 wp
->screen
= &wp
->base
;
607 window_pane_destroy(struct window_pane
*wp
)
609 window_pane_reset_mode(wp
);
613 bufferevent_free(wp
->event
);
618 screen_free(&wp
->base
);
619 if (wp
->saved_grid
!= NULL
)
620 grid_destroy(wp
->saved_grid
);
622 if (wp
->pipe_fd
!= -1) {
624 bufferevent_free(wp
->pipe_event
);
627 RB_REMOVE(window_pane_tree
, &all_window_panes
, wp
);
631 if (wp
->shell
!= NULL
)
639 window_pane_spawn(struct window_pane
*wp
, const char *cmd
, const char *shell
,
640 const char *cwd
, struct environ
*env
, struct termios
*tio
, char **cause
)
643 char *argv0
, paneid
[16];
649 bufferevent_free(wp
->event
);
654 wp
->cmd
= xstrdup(cmd
);
657 if (wp
->shell
!= NULL
)
659 wp
->shell
= xstrdup(shell
);
664 wp
->cwd
= xstrdup(cwd
);
667 memset(&ws
, 0, sizeof ws
);
668 ws
.ws_col
= screen_size_x(&wp
->base
);
669 ws
.ws_row
= screen_size_y(&wp
->base
);
671 switch (wp
->pid
= forkpty(&wp
->fd
, wp
->tty
, NULL
, &ws
)) {
674 xasprintf(cause
, "%s: %s", cmd
, strerror(errno
));
677 if (chdir(wp
->cwd
) != 0)
680 if (tcgetattr(STDIN_FILENO
, &tio2
) != 0)
681 fatal("tcgetattr failed");
683 memcpy(tio2
.c_cc
, tio
->c_cc
, sizeof tio2
.c_cc
);
684 tio2
.c_cc
[VERASE
] = '\177';
685 if (tcsetattr(STDIN_FILENO
, TCSANOW
, &tio2
) != 0)
686 fatal("tcgetattr failed");
688 closefrom(STDERR_FILENO
+ 1);
690 xsnprintf(paneid
, sizeof paneid
, "%%%u", wp
->id
);
691 environ_set(env
, "TMUX_PANE", paneid
);
697 if (*wp
->cmd
!= '\0') {
698 /* Set SHELL but only if it is currently not useful. */
699 shell
= getenv("SHELL");
700 if (shell
== NULL
|| *shell
== '\0' || areshell(shell
))
701 setenv("SHELL", wp
->shell
, 1);
703 execl(_PATH_BSHELL
, "sh", "-c", wp
->cmd
, (char *) NULL
);
704 fatal("execl failed");
707 /* No command; fork a login shell. */
708 ptr
= strrchr(wp
->shell
, '/');
709 if (ptr
!= NULL
&& *(ptr
+ 1) != '\0')
710 xasprintf(&argv0
, "-%s", ptr
+ 1);
712 xasprintf(&argv0
, "-%s", wp
->shell
);
713 setenv("SHELL", wp
->shell
, 1);
714 execl(wp
->shell
, argv0
, (char *) NULL
);
715 fatal("execl failed");
718 setblocking(wp
->fd
, 0);
720 wp
->event
= bufferevent_new(wp
->fd
,
721 window_pane_read_callback
, NULL
, window_pane_error_callback
, wp
);
722 bufferevent_enable(wp
->event
, EV_READ
|EV_WRITE
);
729 window_pane_read_callback(unused
struct bufferevent
*bufev
, void *data
)
731 struct window_pane
*wp
= data
;
735 new_size
= EVBUFFER_LENGTH(wp
->event
->input
) - wp
->pipe_off
;
736 if (wp
->pipe_fd
!= -1 && new_size
> 0) {
737 new_data
= EVBUFFER_DATA(wp
->event
->input
);
738 bufferevent_write(wp
->pipe_event
, new_data
, new_size
);
743 wp
->pipe_off
= EVBUFFER_LENGTH(wp
->event
->input
);
746 * If we get here, we're not outputting anymore, so set the silence
747 * flag on the window.
749 wp
->window
->flags
|= WINDOW_SILENCE
;
750 if (gettimeofday(&wp
->window
->silence_timer
, NULL
) != 0)
751 fatal("gettimeofday failed.");
756 window_pane_error_callback(
757 unused
struct bufferevent
*bufev
, unused
short what
, void *data
)
759 struct window_pane
*wp
= data
;
761 server_destroy_pane(wp
);
765 window_pane_resize(struct window_pane
*wp
, u_int sx
, u_int sy
)
769 if (sx
== wp
->sx
&& sy
== wp
->sy
)
774 memset(&ws
, 0, sizeof ws
);
778 screen_resize(&wp
->base
, sx
, sy
);
779 if (wp
->mode
!= NULL
)
780 wp
->mode
->resize(wp
, sx
, sy
);
782 if (wp
->fd
!= -1 && ioctl(wp
->fd
, TIOCSWINSZ
, &ws
) == -1)
783 fatal("ioctl failed");
787 * Enter alternative screen mode. A copy of the visible screen is saved and the
788 * history is not updated
791 window_pane_alternate_on(struct window_pane
*wp
, struct grid_cell
*gc
)
793 struct screen
*s
= &wp
->base
;
796 if (wp
->saved_grid
!= NULL
)
798 if (!options_get_number(&wp
->window
->options
, "alternate-screen"))
800 sx
= screen_size_x(s
);
801 sy
= screen_size_y(s
);
803 wp
->saved_grid
= grid_create(sx
, sy
, 0);
804 grid_duplicate_lines(wp
->saved_grid
, 0, s
->grid
, screen_hsize(s
), sy
);
805 wp
->saved_cx
= s
->cx
;
806 wp
->saved_cy
= s
->cy
;
807 memcpy(&wp
->saved_cell
, gc
, sizeof wp
->saved_cell
);
809 grid_view_clear(s
->grid
, 0, 0, sx
, sy
);
811 wp
->base
.grid
->flags
&= ~GRID_HISTORY
;
813 wp
->flags
|= PANE_REDRAW
;
816 /* Exit alternate screen mode and restore the copied grid. */
818 window_pane_alternate_off(struct window_pane
*wp
, struct grid_cell
*gc
)
820 struct screen
*s
= &wp
->base
;
823 if (wp
->saved_grid
== NULL
)
825 if (!options_get_number(&wp
->window
->options
, "alternate-screen"))
827 sx
= screen_size_x(s
);
828 sy
= screen_size_y(s
);
831 * If the current size is bigger, temporarily resize to the old size
832 * before copying back.
834 if (sy
> wp
->saved_grid
->sy
)
835 screen_resize(s
, sx
, wp
->saved_grid
->sy
);
837 /* Restore the grid, cursor position and cell. */
838 grid_duplicate_lines(s
->grid
, screen_hsize(s
), wp
->saved_grid
, 0, sy
);
839 s
->cx
= wp
->saved_cx
;
840 if (s
->cx
> screen_size_x(s
) - 1)
841 s
->cx
= screen_size_x(s
) - 1;
842 s
->cy
= wp
->saved_cy
;
843 if (s
->cy
> screen_size_y(s
) - 1)
844 s
->cy
= screen_size_y(s
) - 1;
845 memcpy(gc
, &wp
->saved_cell
, sizeof *gc
);
848 * Turn history back on (so resize can use it) and then resize back to
851 wp
->base
.grid
->flags
|= GRID_HISTORY
;
852 if (sy
> wp
->saved_grid
->sy
)
853 screen_resize(s
, sx
, sy
);
855 grid_destroy(wp
->saved_grid
);
856 wp
->saved_grid
= NULL
;
858 wp
->flags
|= PANE_REDRAW
;
862 window_pane_set_mode(struct window_pane
*wp
, const struct window_mode
*mode
)
866 if (wp
->mode
!= NULL
)
870 if ((s
= wp
->mode
->init(wp
)) != NULL
)
872 wp
->flags
|= PANE_REDRAW
;
877 window_pane_reset_mode(struct window_pane
*wp
)
879 if (wp
->mode
== NULL
)
885 wp
->screen
= &wp
->base
;
886 wp
->flags
|= PANE_REDRAW
;
890 window_pane_key(struct window_pane
*wp
, struct session
*sess
, int key
)
892 struct window_pane
*wp2
;
894 if (!window_pane_visible(wp
))
897 if (wp
->mode
!= NULL
) {
898 if (wp
->mode
->key
!= NULL
)
899 wp
->mode
->key(wp
, sess
, key
);
906 if (options_get_number(&wp
->window
->options
, "synchronize-panes")) {
907 TAILQ_FOREACH(wp2
, &wp
->window
->panes
, entry
) {
908 if (wp2
== wp
|| wp2
->mode
!= NULL
)
910 if (wp2
->fd
!= -1 && window_pane_visible(wp2
))
918 struct window_pane
*wp
, struct session
*sess
, struct mouse_event
*m
)
920 if (!window_pane_visible(wp
))
923 if (m
->x
< wp
->xoff
|| m
->x
>= wp
->xoff
+ wp
->sx
)
925 if (m
->y
< wp
->yoff
|| m
->y
>= wp
->yoff
+ wp
->sy
)
930 if (wp
->mode
!= NULL
) {
931 if (wp
->mode
->mouse
!= NULL
&&
932 options_get_number(&wp
->window
->options
, "mode-mouse"))
933 wp
->mode
->mouse(wp
, sess
, m
);
934 } else if (wp
->fd
!= -1)
939 window_pane_visible(struct window_pane
*wp
)
941 struct window
*w
= wp
->window
;
943 if (wp
->xoff
>= w
->sx
|| wp
->yoff
>= w
->sy
)
945 if (wp
->xoff
+ wp
->sx
> w
->sx
|| wp
->yoff
+ wp
->sy
> w
->sy
)
951 window_pane_search(struct window_pane
*wp
, const char *searchstr
, u_int
*lineno
)
953 struct screen
*s
= &wp
->base
;
954 char *newsearchstr
, *line
, *msg
;
958 xasprintf(&newsearchstr
, "*%s*", searchstr
);
960 for (i
= 0; i
< screen_size_y(s
); i
++) {
961 line
= grid_view_string_cells(s
->grid
, 0, i
, screen_size_x(s
));
962 if (fnmatch(newsearchstr
, line
, 0) == 0) {
975 /* Find the pane directly above another. */
977 window_pane_find_up(struct window_pane
*wp
)
979 struct window_pane
*wp2
;
982 if (wp
== NULL
|| !window_pane_visible(wp
))
987 top
= wp
->window
->sy
+ 1;
990 TAILQ_FOREACH(wp2
, &wp
->window
->panes
, entry
) {
991 if (!window_pane_visible(wp2
))
993 if (wp2
->yoff
+ wp2
->sy
+ 1 != top
)
995 if (left
>= wp2
->xoff
&& left
<= wp2
->xoff
+ wp2
->sx
)
1001 /* Find the pane directly below another. */
1002 struct window_pane
*
1003 window_pane_find_down(struct window_pane
*wp
)
1005 struct window_pane
*wp2
;
1008 if (wp
== NULL
|| !window_pane_visible(wp
))
1011 bottom
= wp
->yoff
+ wp
->sy
+ 1;
1012 if (bottom
>= wp
->window
->sy
)
1016 TAILQ_FOREACH(wp2
, &wp
->window
->panes
, entry
) {
1017 if (!window_pane_visible(wp2
))
1019 if (wp2
->yoff
!= bottom
)
1021 if (left
>= wp2
->xoff
&& left
<= wp2
->xoff
+ wp2
->sx
)
1028 * Find the pane directly to the left of another, adjacent to the left side and
1029 * containing the top edge.
1031 struct window_pane
*
1032 window_pane_find_left(struct window_pane
*wp
)
1034 struct window_pane
*wp2
;
1037 if (wp
== NULL
|| !window_pane_visible(wp
))
1042 left
= wp
->window
->sx
+ 1;
1045 TAILQ_FOREACH(wp2
, &wp
->window
->panes
, entry
) {
1046 if (!window_pane_visible(wp2
))
1048 if (wp2
->xoff
+ wp2
->sx
+ 1 != left
)
1050 if (top
>= wp2
->yoff
&& top
<= wp2
->yoff
+ wp2
->sy
)
1057 * Find the pane directly to the right of another, that is adjacent to the
1058 * right edge and including the top edge.
1060 struct window_pane
*
1061 window_pane_find_right(struct window_pane
*wp
)
1063 struct window_pane
*wp2
;
1066 if (wp
== NULL
|| !window_pane_visible(wp
))
1069 right
= wp
->xoff
+ wp
->sx
+ 1;
1070 if (right
>= wp
->window
->sx
)
1074 TAILQ_FOREACH(wp2
, &wp
->window
->panes
, entry
) {
1075 if (!window_pane_visible(wp2
))
1077 if (wp2
->xoff
!= right
)
1079 if (top
>= wp2
->yoff
&& top
<= wp2
->yoff
+ wp2
->sy
)