summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/server-client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2024-11-15 13:12:21 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2024-11-15 13:12:21 +0000
commitae58853c01a2c1ba5f25057625b07899fb2645e7 (patch)
tree8afe016bbff385b3ea46f1ebb8be3d46449ff480 /usr.bin/tmux/server-client.c
parent3989fb3ccf3fa91bf09d92e8e7e721d5454f5264 (diff)
Add two new style parameters, width and pad, which apply to scrollbars.
From Michael Grant, GitHub issue 4241.
Diffstat (limited to 'usr.bin/tmux/server-client.c')
-rw-r--r--usr.bin/tmux/server-client.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index c7c84377027..d76a867135c 100644
--- a/usr.bin/tmux/server-client.c
+++ b/usr.bin/tmux/server-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.417 2024/11/15 09:01:16 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.418 2024/11/15 13:12:20 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -581,7 +581,7 @@ server_client_check_mouse(struct client *c, struct key_event *event)
struct window_pane *wp, *fwp;
u_int x, y, b, sx, sy, px, py, line = 0, sb_pos;
u_int sl_top, sl_bottom, sl_mpos = 0;
- int ignore = 0, sb, sb_w, pane_status;
+ int ignore = 0, sb, sb_w, sb_pad, pane_status;
key_code key;
struct timeval tv;
struct style_range *sr;
@@ -783,10 +783,15 @@ have_event:
/* Try the scrollbar next to a pane. */
sb = options_get_number(wo, "pane-scrollbars");
- if (window_pane_show_scrollbar(wp, sb))
- sb_w = PANE_SCROLLBARS_WIDTH;
- else
+ sb_pos = options_get_number(wo,
+ "pane-scrollbars-position");
+ if (window_pane_show_scrollbar(wp, sb)) {
+ sb_w = wp->scrollbar_style.width;
+ sb_pad = wp->scrollbar_style.pad;
+ } else {
sb_w = 0;
+ sb_pad = 0;
+ }
pane_status = options_get_number(wo,
"pane-border-status");
if (pane_status == PANE_STATUS_TOP)
@@ -795,8 +800,9 @@ have_event:
line = wp->yoff + wp->sy;
/*
- * Check if py could lie within a scrollbar. If the
- * pane is at the top, then py is 0; if not then the
+ * Check if py could lie within a scrollbar
+ * (but not within the padding). If the pane is
+ * at the top, then py is 0; if not then the
* top, then yoff to yoff + sy.
*/
if ((pane_status != PANE_STATUS_OFF && py != line) ||
@@ -805,11 +811,11 @@ have_event:
sb_pos = options_get_number(wo,
"pane-scrollbars-position");
if ((sb_pos == PANE_SCROLLBARS_RIGHT &&
- (px >= wp->xoff + wp->sx &&
- px < wp->xoff + wp->sx + sb_w)) ||
+ (px >= wp->xoff + wp->sx + sb_pad &&
+ px < wp->xoff + wp->sx + sb_pad + sb_w)) ||
(sb_pos == PANE_SCROLLBARS_LEFT &&
- (px >= wp->xoff - sb_w &&
- px < wp->xoff))) {
+ (px >= wp->xoff - sb_pad - sb_w &&
+ px < wp->xoff - sb_pad))) {
sl_top = wp->yoff + wp->sb_slider_y;
sl_bottom = (wp->yoff +
wp->sb_slider_y +