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:
nicm
2024-11-05 09:41:17 +00:00
parent a0c79aa87b
commit 09f4e43189
10 changed files with 481 additions and 108 deletions

25
tmux.h
View File

@ -739,6 +739,7 @@ struct colour_palette {
#define CELL_RIGHTJOIN 10
#define CELL_JOIN 11
#define CELL_OUTSIDE 12
#define CELL_SCROLLBAR 13
/* Cell borders. */
#define CELL_BORDERS " xqlkmjwvtun~"
@ -985,6 +986,9 @@ struct screen_redraw_ctx {
int pane_status;
enum pane_lines pane_lines;
int pane_scrollbars;
int pane_scrollbars_pos;
struct grid_cell no_pane_gc;
int no_pane_gc_set;
@ -1103,6 +1107,7 @@ struct window_pane {
#define PANE_EMPTY 0x800
#define PANE_STYLECHANGED 0x1000
#define PANE_UNSEENCHANGES 0x2000
#define PANE_REDRAWSCROLLBAR 0x4000
int argc;
char **argv;
@ -1245,6 +1250,19 @@ TAILQ_HEAD(winlink_stack, winlink);
#define PANE_STATUS_TOP 1
#define PANE_STATUS_BOTTOM 2
/* Pane scrollbars option. */
#define PANE_SCROLLBARS_OFF 0
#define PANE_SCROLLBARS_MODAL 1
#define PANE_SCROLLBARS_ALWAYS 2
/* Pane scrollbars position option. */
#define PANE_SCROLLBARS_RIGHT 0
#define PANE_SCROLLBARS_LEFT 1
/* Pane scrollbars width and padding. */
#define PANE_SCROLLBARS_WIDTH 1
#define PANE_SCROLLBARS_PADDING 0
/* Layout direction. */
enum layout_type {
LAYOUT_LEFTRIGHT,
@ -1880,13 +1898,15 @@ struct client {
#define CLIENT_CLIPBOARDBUFFER 0x800000000ULL
#define CLIENT_BRACKETPASTING 0x1000000000ULL
#define CLIENT_ASSUMEPASTING 0x2000000000ULL
#define CLIENT_REDRAWSCROLLBARS 0x4000000000ULL
#define CLIENT_ALLREDRAWFLAGS \
(CLIENT_REDRAWWINDOW| \
CLIENT_REDRAWSTATUS| \
CLIENT_REDRAWSTATUSALWAYS| \
CLIENT_REDRAWBORDERS| \
CLIENT_REDRAWOVERLAY| \
CLIENT_REDRAWPANES)
CLIENT_REDRAWPANES| \
CLIENT_REDRAWSCROLLBARS)
#define CLIENT_UNATTACHEDFLAGS \
(CLIENT_DEAD| \
CLIENT_SUSPENDED| \
@ -1913,6 +1933,7 @@ struct client {
key_code last_key;
uint64_t redraw_panes;
uint64_t redraw_scrollbars;
int message_ignore_keys;
int message_ignore_styles;
@ -3014,7 +3035,7 @@ void screen_write_alternateoff(struct screen_write_ctx *,
/* screen-redraw.c */
void screen_redraw_screen(struct client *);
void screen_redraw_pane(struct client *, struct window_pane *);
void screen_redraw_pane(struct client *, struct window_pane *, int);
/* screen.c */
void screen_init(struct screen *, u_int, u_int, u_int);