Fix vertical position of scrollbar having wrong vertical offset when

status-position top, from Michael Grant.
This commit is contained in:
nicm
2026-06-01 20:00:25 +00:00
parent 922f7d1645
commit 3269833caa

View File

@@ -1476,6 +1476,7 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx,
int px, py, wx, wy, ox, oy, sx, sy, sb_tty_y; int px, py, wx, wy, ox, oy, sx, sy, sb_tty_y;
int xoff = wp->xoff; int xoff = wp->xoff;
int yoff = wp->yoff; int yoff = wp->yoff;
int sb_wy = sb_y; /* window coordinates */
struct visible_ranges *r; struct visible_ranges *r;
/* /*
@@ -1487,9 +1488,8 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx,
ox = ctx->ox; ox = ctx->ox;
oy = ctx->oy; oy = ctx->oy;
if (ctx->statustop) { if (ctx->statustop) {
sb_y += ctx->statuslines; sb_y += ctx->statuslines; /* tty coordinates */
sy += ctx->statuslines; /* height of window */ sy += ctx->statuslines;
oy += ctx->statuslines; /* top of window */
} }
gc = sb_style->gc; gc = sb_style->gc;
@@ -1521,8 +1521,8 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx,
} }
/* /*
* sb_y is a window coordinate; convert to tty coordinate by * sb_y is in tty coordinate (window coord + statuslines when
* subtracting the pan offset oy. * statustop). Subtract the pan offset oy to get the tty row.
*/ */
sb_tty_y = sb_y - oy; /* scrollbar top in tty coordinates */ sb_tty_y = sb_y - oy; /* scrollbar top in tty coordinates */
if (sb_tty_y > (int)sy) { if (sb_tty_y > (int)sy) {
@@ -1544,7 +1544,7 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx,
} }
for (j = jmin; j < jmax; j++) { for (j = jmin; j < jmax; j++) {
wy = sb_y + j; /* window y coordinate */ wy = sb_wy + j; /* window y coordinate */
py = sb_tty_y + j; /* tty y coordinate */ py = sb_tty_y + j; /* tty y coordinate */
r = tty_check_overlay_range(tty, sb_x, wy, imax); r = tty_check_overlay_range(tty, sb_x, wy, imax);
r = screen_redraw_get_visible_ranges(wp, sb_x, wy, imax, r); r = screen_redraw_get_visible_ranges(wp, sb_x, wy, imax, r);