mirror of
https://github.com/tmux/tmux.git
synced 2026-02-16 02:59:16 +00:00
Second try with static visual_ranges using calloc.
This commit is contained in:
@@ -1137,8 +1137,7 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px,
|
|||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
struct window *w;
|
struct window *w;
|
||||||
struct visible_range *ri;
|
struct visible_range *ri;
|
||||||
static struct visible_range sr0 = { 0, 0 };
|
static struct visible_ranges sr = { NULL, 0, 0 };
|
||||||
static struct visible_ranges sr = { &sr0, 1, 1 };
|
|
||||||
int found_self, sb_w, sb_pos;
|
int found_self, sb_w, sb_pos;
|
||||||
u_int lb, rb, tb, bb;
|
u_int lb, rb, tb, bb;
|
||||||
u_int i, s;
|
u_int i, s;
|
||||||
@@ -1148,8 +1147,13 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px,
|
|||||||
return (r);
|
return (r);
|
||||||
} else {
|
} else {
|
||||||
/* Return static range as last resort. */
|
/* Return static range as last resort. */
|
||||||
|
if (sr.ranges == NULL)
|
||||||
|
sr.ranges = xcalloc(1,
|
||||||
|
sizeof (struct visible_range));
|
||||||
sr.ranges[0].px = px;
|
sr.ranges[0].px = px;
|
||||||
sr.ranges[0].nx = width;
|
sr.ranges[0].nx = width;
|
||||||
|
sr.size = 1;
|
||||||
|
sr.used = 1;
|
||||||
return (&sr);
|
return (&sr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1849,13 +1849,13 @@ screen_write_collect_flush(struct screen_write_ctx *ctx, int scroll_only,
|
|||||||
ctx->scrolled = s->rlower - s->rupper + 1;
|
ctx->scrolled = s->rlower - s->rupper + 1;
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 1);
|
screen_write_initctx(ctx, &ttyctx, 1);
|
||||||
if (wp->yoff + wp->sy > wp->window->sy)
|
if (wp != NULL && wp->yoff + wp->sy > wp->window->sy)
|
||||||
ttyctx.orlower -= (wp->yoff + wp->sy - wp->window->sy);
|
ttyctx.orlower -= (wp->yoff + wp->sy - wp->window->sy);
|
||||||
ttyctx.num = ctx->scrolled;
|
ttyctx.num = ctx->scrolled;
|
||||||
ttyctx.bg = ctx->bg;
|
ttyctx.bg = ctx->bg;
|
||||||
tty_write(tty_cmd_scrollup, &ttyctx);
|
tty_write(tty_cmd_scrollup, &ttyctx);
|
||||||
|
|
||||||
if (ctx->wp != NULL)
|
if (wp != NULL)
|
||||||
ctx->wp->flags |= PANE_REDRAWSCROLLBAR;
|
ctx->wp->flags |= PANE_REDRAWSCROLLBAR;
|
||||||
}
|
}
|
||||||
ctx->scrolled = 0;
|
ctx->scrolled = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user