diff --git a/screen-redraw.c b/screen-redraw.c index c70e6d24..84d219d5 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -1480,6 +1480,7 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx, int px, py, wx, wy, ox, oy, sx, sy, sb_tty_y; int xoff = wp->xoff; int yoff = wp->yoff; + int sb_wy = sb_y; /* window coordinates */ struct visible_ranges *r; /* @@ -1491,9 +1492,8 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx, ox = ctx->ox; oy = ctx->oy; if (ctx->statustop) { - sb_y += ctx->statuslines; - sy += ctx->statuslines; /* height of window */ - oy += ctx->statuslines; /* top of window */ + sb_y += ctx->statuslines; /* tty coordinates */ + sy += ctx->statuslines; } gc = sb_style->gc; @@ -1525,8 +1525,8 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx, } /* - * sb_y is a window coordinate; convert to tty coordinate by - * subtracting the pan offset oy. + * sb_y is in tty coordinate (window coord + statuslines when + * statustop). Subtract the pan offset oy to get the tty row. */ sb_tty_y = sb_y - oy; /* scrollbar top in tty coordinates */ if (sb_tty_y > (int)sy) { @@ -1548,7 +1548,7 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx, } 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 */ r = tty_check_overlay_range(tty, sb_x, wy, imax); r = screen_redraw_get_visible_ranges(wp, sb_x, wy, imax, r); diff --git a/spawn.c b/spawn.c index 7219a67a..35f21ccd 100644 --- a/spawn.c +++ b/spawn.c @@ -269,23 +269,25 @@ spawn_pane(struct spawn_context *sc, char **cause) sc->wp0->ictx = NULL; new_wp = sc->wp0; new_wp->flags &= ~(PANE_STATUSREADY|PANE_STATUSDRAWN); - } else if (sc->lc == NULL) { - new_wp = window_add_pane(w, NULL, hlimit, sc->flags); - layout_init(w, new_wp); } else { - new_wp = window_add_pane(w, sc->wp0, hlimit, sc->flags); - if (sc->flags & SPAWN_ZOOM) - layout_assign_pane(sc->lc, new_wp, 1); - else - layout_assign_pane(sc->lc, new_wp, 0); - } + if (sc->lc == NULL) { + new_wp = window_add_pane(w, NULL, hlimit, sc->flags); + layout_init(w, new_wp); + } else { + new_wp = window_add_pane(w, sc->wp0, hlimit, sc->flags); + if (sc->flags & SPAWN_ZOOM) + layout_assign_pane(sc->lc, new_wp, 1); + else + layout_assign_pane(sc->lc, new_wp, 0); + } - /* - * If window currently zoomed, window_set_active_pane calls - * window_unzoom which it copies back the saved_layout_cell. - */ - if (w->flags & WINDOW_ZOOMED) - new_wp->saved_layout_cell = new_wp->layout_cell; + /* + * If window currently zoomed, window_set_active_pane calls + * window_unzoom which it copies back the saved_layout_cell. + */ + if (w->flags & WINDOW_ZOOMED) + new_wp->saved_layout_cell = new_wp->layout_cell; + } /* * Now we have a pane with nothing running in it ready for the new diff --git a/window.c b/window.c index 164d8111..c057c55b 100644 --- a/window.c +++ b/window.c @@ -644,16 +644,11 @@ window_get_active_at(struct window *w, u_int x, u_int y) continue; } } else { - /* Floating - include top or or left border. */ + /* Floating - include all borders. */ if ((int)x < xoff - 1 || x > xoff + sx) continue; - if (pane_status == PANE_STATUS_TOP) { - if ((int)y <= yoff - 2 || y > yoff + sy - 1) - continue; - } else { - if ((int)y < yoff - 1 || y > yoff + sy) - continue; - } + if ((int)y < yoff - 1 || y > yoff + sy) + continue; } return (wp); }