mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Add support for a scrollbar at the side of each pane. New options
pane-scrollbars turn them on or off, pane-scrollbars-position sets the position (left or right), and pane-scrollbars-style to set the colours. Mouse support will come later. From Michael Grant in GitHub issue 4221.
This commit is contained in:
		
							
								
								
									
										33
									
								
								window.c
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								window.c
									
									
									
									
									
								
							@@ -584,11 +584,31 @@ struct window_pane *
 | 
			
		||||
window_get_active_at(struct window *w, u_int x, u_int y)
 | 
			
		||||
{
 | 
			
		||||
	struct window_pane	*wp;
 | 
			
		||||
	int			 pane_scrollbars;
 | 
			
		||||
	u_int			 sb_pos, sb_w, xoff, sx;
 | 
			
		||||
 | 
			
		||||
	pane_scrollbars = options_get_number(w->options, "pane-scrollbars");
 | 
			
		||||
	sb_pos = options_get_number(w->options, "pane-scrollbars-position");
 | 
			
		||||
 | 
			
		||||
	TAILQ_FOREACH(wp, &w->panes, entry) {
 | 
			
		||||
		if (!window_pane_visible(wp))
 | 
			
		||||
			continue;
 | 
			
		||||
		if (x < wp->xoff || x > wp->xoff + wp->sx)
 | 
			
		||||
 | 
			
		||||
		if (pane_scrollbars == PANE_SCROLLBARS_ALWAYS ||
 | 
			
		||||
		    (pane_scrollbars == PANE_SCROLLBARS_MODAL &&
 | 
			
		||||
		     window_pane_mode(wp) != WINDOW_PANE_NO_MODE))
 | 
			
		||||
			sb_w = PANE_SCROLLBARS_WIDTH;
 | 
			
		||||
		else
 | 
			
		||||
			sb_w = 0;
 | 
			
		||||
 | 
			
		||||
		if (sb_pos == PANE_SCROLLBARS_LEFT) {
 | 
			
		||||
			xoff = wp->xoff - sb_w;
 | 
			
		||||
			sx = wp->sx + sb_w;
 | 
			
		||||
		} else { /* sb_pos == PANE_SCROLLBARS_RIGHT */
 | 
			
		||||
			xoff = wp->xoff;
 | 
			
		||||
			sx = wp->sx + sb_w;
 | 
			
		||||
		}
 | 
			
		||||
		if (x < xoff || x > xoff + sx)
 | 
			
		||||
			continue;
 | 
			
		||||
		if (y < wp->yoff || y > wp->yoff + wp->sy)
 | 
			
		||||
			continue;
 | 
			
		||||
@@ -1086,6 +1106,7 @@ window_pane_set_mode(struct window_pane *wp, struct window_pane *swp,
 | 
			
		||||
    struct args *args)
 | 
			
		||||
{
 | 
			
		||||
	struct window_mode_entry	*wme;
 | 
			
		||||
	struct window			*w = wp->window;
 | 
			
		||||
 | 
			
		||||
	if (!TAILQ_EMPTY(&wp->modes) && TAILQ_FIRST(&wp->modes)->mode == mode)
 | 
			
		||||
		return (1);
 | 
			
		||||
@@ -1106,9 +1127,10 @@ window_pane_set_mode(struct window_pane *wp, struct window_pane *swp,
 | 
			
		||||
		TAILQ_INSERT_HEAD(&wp->modes, wme, entry);
 | 
			
		||||
		wme->screen = wme->mode->init(wme, fs, args);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	wp->screen = wme->screen;
 | 
			
		||||
	wp->flags |= (PANE_REDRAW|PANE_CHANGED);
 | 
			
		||||
 | 
			
		||||
	wp->flags |= (PANE_REDRAW|PANE_REDRAWSCROLLBAR|PANE_CHANGED);
 | 
			
		||||
	layout_fix_panes(w, NULL);
 | 
			
		||||
 | 
			
		||||
	server_redraw_window_borders(wp->window);
 | 
			
		||||
	server_status_window(wp->window);
 | 
			
		||||
@@ -1121,6 +1143,7 @@ void
 | 
			
		||||
window_pane_reset_mode(struct window_pane *wp)
 | 
			
		||||
{
 | 
			
		||||
	struct window_mode_entry	*wme, *next;
 | 
			
		||||
	struct window			*w = wp->window;
 | 
			
		||||
 | 
			
		||||
	if (TAILQ_EMPTY(&wp->modes))
 | 
			
		||||
		return;
 | 
			
		||||
@@ -1141,7 +1164,9 @@ window_pane_reset_mode(struct window_pane *wp)
 | 
			
		||||
		if (next->mode->resize != NULL)
 | 
			
		||||
			next->mode->resize(next, wp->sx, wp->sy);
 | 
			
		||||
	}
 | 
			
		||||
	wp->flags |= (PANE_REDRAW|PANE_CHANGED);
 | 
			
		||||
 | 
			
		||||
	wp->flags |= (PANE_REDRAW|PANE_REDRAWSCROLLBAR|PANE_CHANGED);
 | 
			
		||||
	layout_fix_panes(w, NULL);
 | 
			
		||||
 | 
			
		||||
	server_redraw_window_borders(wp->window);
 | 
			
		||||
	server_status_window(wp->window);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user