aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--format.c9
-rw-r--r--grid-view.c16
-rw-r--r--grid.c4
-rw-r--r--input.c11
-rw-r--r--screen-write.c35
-rw-r--r--server-fn.c2
-rw-r--r--tmux.h13
-rw-r--r--tty.c12
-rw-r--r--window-copy.c2
9 files changed, 66 insertions, 38 deletions
diff --git a/format.c b/format.c
index 7bf3a540..5a5dabbe 100644
--- a/format.c
+++ b/format.c
@@ -226,12 +226,12 @@ format_job_update(struct job *job)
free(fj->out);
fj->out = line;
- log_debug("%s: %s: %s", __func__, fj->cmd, fj->out);
+ log_debug("%s: %p %s: %s", __func__, fj, fj->cmd, fj->out);
t = time (NULL);
if (fj->status && fj->last != t) {
- TAILQ_FOREACH(c, &clients, entry)
- server_status_client(c);
+ if (fj->client != NULL)
+ server_status_client(fj->client);
fj->last = t;
}
}
@@ -256,10 +256,11 @@ format_job_complete(struct job *job)
} else
buf = line;
+ log_debug("%s: %p %s: %s", __func__, fj, fj->cmd, buf);
+
if (*buf != '\0' || !fj->updated) {
free(fj->out);
fj->out = buf;
- log_debug("%s: %s: %s", __func__, fj->cmd, fj->out);
} else
free(buf);
diff --git a/grid-view.c b/grid-view.c
index fe096252..033ec033 100644
--- a/grid-view.c
+++ b/grid-view.c
@@ -96,32 +96,34 @@ grid_view_clear(struct grid *gd, u_int px, u_int py, u_int nx, u_int ny,
/* Scroll region up. */
void
-grid_view_scroll_region_up(struct grid *gd, u_int rupper, u_int rlower)
+grid_view_scroll_region_up(struct grid *gd, u_int rupper, u_int rlower,
+ u_int bg)
{
if (gd->flags & GRID_HISTORY) {
- grid_collect_history(gd, 8);
+ grid_collect_history(gd, bg);
if (rupper == 0 && rlower == gd->sy - 1)
- grid_scroll_history(gd, 8);
+ grid_scroll_history(gd, bg);
else {
rupper = grid_view_y(gd, rupper);
rlower = grid_view_y(gd, rlower);
- grid_scroll_history_region(gd, rupper, rlower);
+ grid_scroll_history_region(gd, rupper, rlower, bg);
}
} else {
rupper = grid_view_y(gd, rupper);
rlower = grid_view_y(gd, rlower);
- grid_move_lines(gd, rupper, rupper + 1, rlower - rupper, 8);
+ grid_move_lines(gd, rupper, rupper + 1, rlower - rupper, bg);
}
}
/* Scroll region down. */
void
-grid_view_scroll_region_down(struct grid *gd, u_int rupper, u_int rlower)
+grid_view_scroll_region_down(struct grid *gd, u_int rupper, u_int rlower,
+ u_int bg)
{
rupper = grid_view_y(gd, rupper);
rlower = grid_view_y(gd, rlower);
- grid_move_lines(gd, rupper + 1, rupper, rlower - rupper, 8);
+ grid_move_lines(gd, rupper + 1, rupper, rlower - rupper, bg);
}
/* Insert lines. */
diff --git a/grid.c b/grid.c
index 25b0d016..4f728dbe 100644
--- a/grid.c
+++ b/grid.c
@@ -284,7 +284,7 @@ grid_clear_history(struct grid *gd)
/* Scroll a region up, moving the top line into the history. */
void
-grid_scroll_history_region(struct grid *gd, u_int upper, u_int lower)
+grid_scroll_history_region(struct grid *gd, u_int upper, u_int lower, u_int bg)
{
struct grid_line *gl_history, *gl_upper, *gl_lower;
u_int yy;
@@ -309,7 +309,7 @@ grid_scroll_history_region(struct grid *gd, u_int upper, u_int lower)
/* Then move the region up and clear the bottom line. */
memmove(gl_upper, gl_upper + 1, (lower - upper) * sizeof *gl_upper);
- memset(gl_lower, 0, sizeof *gl_lower);
+ grid_empty_line(gd, lower, bg);
/* Move the history offset down over the line. */
gd->hscrolled++;
diff --git a/input.c b/input.c
index 22dd1ee2..a6dd0fea 100644
--- a/input.c
+++ b/input.c
@@ -1123,7 +1123,7 @@ input_c0_dispatch(struct input_ctx *ictx)
case '\012': /* LF */
case '\013': /* VT */
case '\014': /* FF */
- screen_write_linefeed(sctx, 0);
+ screen_write_linefeed(sctx, 0, ictx->cell.cell.bg);
break;
case '\015': /* CR */
screen_write_carriagereturn(sctx);
@@ -1168,18 +1168,18 @@ input_esc_dispatch(struct input_ctx *ictx)
screen_write_reset(sctx);
break;
case INPUT_ESC_IND:
- screen_write_linefeed(sctx, 0);
+ screen_write_linefeed(sctx, 0, ictx->cell.cell.bg);
break;
case INPUT_ESC_NEL:
screen_write_carriagereturn(sctx);
- screen_write_linefeed(sctx, 0);
+ screen_write_linefeed(sctx, 0, ictx->cell.cell.bg);
break;
case INPUT_ESC_HTS:
if (s->cx < screen_size_x(s))
bit_set(s->tabs, s->cx);
break;
case INPUT_ESC_RI:
- screen_write_reverseindex(sctx);
+ screen_write_reverseindex(sctx, ictx->cell.cell.bg);
break;
case INPUT_ESC_DECKPAM:
screen_write_mode_set(sctx, MODE_KKEYPAD);
@@ -1417,7 +1417,8 @@ input_csi_dispatch(struct input_ctx *ictx)
input_csi_dispatch_sm_private(ictx);
break;
case INPUT_CSI_SU:
- screen_write_scrollup(sctx, input_get(ictx, 0, 1, 1));
+ screen_write_scrollup(sctx, input_get(ictx, 0, 1, 1),
+ ictx->cell.cell.bg);
break;
case INPUT_CSI_TBC:
switch (input_get(ictx, 0, 0, 0)) {
diff --git a/screen-write.c b/screen-write.c
index 7dace38a..894da4b7 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -75,6 +75,9 @@ screen_write_start(struct screen_write_ctx *ctx, struct window_pane *wp,
TAILQ_INIT(&ctx->list[y].items);
ctx->item = xcalloc(1, sizeof *ctx->item);
+ ctx->scrolled = 0;
+ ctx->bg = 8;
+
if (wp != NULL)
snprintf(tmp, sizeof tmp, "pane %%%u", wp->id);
log_debug("%s: size %ux%u, %s", __func__, screen_size_x(ctx->s),
@@ -387,6 +390,8 @@ screen_write_initctx(struct screen_write_ctx *ctx, struct tty_ctx *ttyctx)
{
struct screen *s = ctx->s;
+ memset(ttyctx, 0, sizeof *ttyctx);
+
ttyctx->wp = ctx->wp;
ttyctx->ocx = s->cx;
@@ -810,15 +815,16 @@ screen_write_cursormove(struct screen_write_ctx *ctx, u_int px, u_int py)
/* Reverse index (up with scroll). */
void
-screen_write_reverseindex(struct screen_write_ctx *ctx)
+screen_write_reverseindex(struct screen_write_ctx *ctx, u_int bg)
{
struct screen *s = ctx->s;
struct tty_ctx ttyctx;
screen_write_initctx(ctx, &ttyctx);
+ ttyctx.bg = bg;
if (s->cy == s->rupper)
- grid_view_scroll_region_down(s->grid, s->rupper, s->rlower);
+ grid_view_scroll_region_down(s->grid, s->rupper, s->rlower, bg);
else if (s->cy > 0)
s->cy--;
@@ -852,7 +858,7 @@ screen_write_scrollregion(struct screen_write_ctx *ctx, u_int rupper,
/* Line feed. */
void
-screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped)
+screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped, u_int bg)
{
struct screen *s = ctx->s;
struct grid *gd = s->grid;
@@ -867,8 +873,13 @@ screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped)
log_debug("%s: at %u,%u (region %u-%u)", __func__, s->cx, s->cy,
s->rupper, s->rlower);
+ if (bg != ctx->bg) {
+ screen_write_collect_flush(ctx, 1);
+ ctx->bg = bg;
+ }
+
if (s->cy == s->rlower) {
- grid_view_scroll_region_up(gd, s->rupper, s->rlower);
+ grid_view_scroll_region_up(gd, s->rupper, s->rlower, bg);
screen_write_collect_scroll(ctx);
ctx->scrolled++;
} else if (s->cy < screen_size_y(s) - 1)
@@ -877,7 +888,7 @@ screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped)
/* Scroll up. */
void
-screen_write_scrollup(struct screen_write_ctx *ctx, u_int lines)
+screen_write_scrollup(struct screen_write_ctx *ctx, u_int lines, u_int bg)
{
struct screen *s = ctx->s;
struct grid *gd = s->grid;
@@ -888,8 +899,13 @@ screen_write_scrollup(struct screen_write_ctx *ctx, u_int lines)
else if (lines > s->rlower - s->rupper + 1)
lines = s->rlower - s->rupper + 1;
+ if (bg != ctx->bg) {
+ screen_write_collect_flush(ctx, 1);
+ ctx->bg = bg;
+ }
+
for (i = 0; i < lines; i++) {
- grid_view_scroll_region_up(gd, s->rupper, s->rlower);
+ grid_view_scroll_region_up(gd, s->rupper, s->rlower, bg);
screen_write_collect_scroll(ctx);
}
ctx->scrolled += lines;
@@ -1044,9 +1060,12 @@ screen_write_collect_flush(struct screen_write_ctx *ctx, int scroll_only)
screen_write_initctx(ctx, &ttyctx);
ttyctx.num = ctx->scrolled;
+ ttyctx.bg = ctx->bg;
tty_write(tty_cmd_scrollup, &ttyctx);
}
ctx->scrolled = 0;
+ ctx->bg = 8;
+
if (scroll_only)
return;
@@ -1141,7 +1160,7 @@ screen_write_collect_add(struct screen_write_ctx *ctx,
if (s->cx > sx - 1) {
log_debug("%s: wrapped at %u,%u", __func__, s->cx, s->cy);
ci->wrapped = 1;
- screen_write_linefeed(ctx, 1);
+ screen_write_linefeed(ctx, 1, 8);
s->cx = 0;
}
@@ -1202,7 +1221,7 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
/* Check this will fit on the current line and wrap if not. */
if ((s->mode & MODE_WRAP) && s->cx > sx - width) {
- screen_write_linefeed(ctx, 1);
+ screen_write_linefeed(ctx, 1, 8);
s->cx = 0;
}
diff --git a/server-fn.c b/server-fn.c
index 0be7f70d..5b1af13e 100644
--- a/server-fn.c
+++ b/server-fn.c
@@ -300,7 +300,7 @@ server_destroy_pane(struct window_pane *wp, int notify)
screen_write_start(&ctx, wp, &wp->base);
screen_write_scrollregion(&ctx, 0, screen_size_y(ctx.s) - 1);
screen_write_cursormove(&ctx, 0, screen_size_y(ctx.s) - 1);
- screen_write_linefeed(&ctx, 1);
+ screen_write_linefeed(&ctx, 1, 8);
memcpy(&gc, &grid_default_cell, sizeof gc);
gc.attr |= GRID_ATTR_BRIGHT;
screen_write_puts(&ctx, &gc, "Pane is dead");
diff --git a/tmux.h b/tmux.h
index ee8785c9..f2fed7ab 100644
--- a/tmux.h
+++ b/tmux.h
@@ -676,6 +676,7 @@ struct screen_write_ctx {
struct screen_write_collect_item *item;
struct screen_write_collect_line *list;
u_int scrolled;
+ u_int bg;
u_int cells;
u_int written;
@@ -1935,7 +1936,7 @@ void grid_destroy(struct grid *);
int grid_compare(struct grid *, struct grid *);
void grid_collect_history(struct grid *, u_int);
void grid_scroll_history(struct grid *, u_int);
-void grid_scroll_history_region(struct grid *, u_int, u_int);
+void grid_scroll_history_region(struct grid *, u_int, u_int, u_int);
void grid_clear_history(struct grid *);
const struct grid_line *grid_peek_line(struct grid *, u_int);
void grid_get_cell(struct grid *, u_int, u_int, struct grid_cell *);
@@ -1960,8 +1961,8 @@ void grid_view_set_cells(struct grid *, u_int, u_int,
const struct grid_cell *, const char *, size_t);
void grid_view_clear_history(struct grid *, u_int);
void grid_view_clear(struct grid *, u_int, u_int, u_int, u_int, u_int);
-void grid_view_scroll_region_up(struct grid *, u_int, u_int);
-void grid_view_scroll_region_down(struct grid *, u_int, u_int);
+void grid_view_scroll_region_up(struct grid *, u_int, u_int, u_int);
+void grid_view_scroll_region_down(struct grid *, u_int, u_int, u_int);
void grid_view_insert_lines(struct grid *, u_int, u_int, u_int);
void grid_view_insert_lines_region(struct grid *, u_int, u_int, u_int,
u_int);
@@ -2008,10 +2009,10 @@ void screen_write_clearline(struct screen_write_ctx *, u_int);
void screen_write_clearendofline(struct screen_write_ctx *, u_int);
void screen_write_clearstartofline(struct screen_write_ctx *, u_int);
void screen_write_cursormove(struct screen_write_ctx *, u_int, u_int);
-void screen_write_reverseindex(struct screen_write_ctx *);
+void screen_write_reverseindex(struct screen_write_ctx *, u_int);
void screen_write_scrollregion(struct screen_write_ctx *, u_int, u_int);
-void screen_write_linefeed(struct screen_write_ctx *, int);
-void screen_write_scrollup(struct screen_write_ctx *, u_int);
+void screen_write_linefeed(struct screen_write_ctx *, int, u_int);
+void screen_write_scrollup(struct screen_write_ctx *, u_int, u_int);
void screen_write_carriagereturn(struct screen_write_ctx *);
void screen_write_clearendofscreen(struct screen_write_ctx *, u_int);
void screen_write_clearstartofscreen(struct screen_write_ctx *, u_int);
diff --git a/tty.c b/tty.c
index 00460574..58a4028c 100644
--- a/tty.c
+++ b/tty.c
@@ -1080,6 +1080,7 @@ tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx)
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
tty_emulate_repeat(tty, TTYC_IL, TTYC_IL1, ctx->num);
+ tty->cx = tty->cy = UINT_MAX;
}
void
@@ -1100,6 +1101,7 @@ tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx)
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
tty_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ctx->num);
+ tty->cx = tty->cy = UINT_MAX;
}
void
@@ -1141,18 +1143,20 @@ tty_cmd_clearstartofline(struct tty *tty, const struct tty_ctx *ctx)
void
tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx)
{
+ struct window_pane *wp = ctx->wp;
+
if (ctx->ocy != ctx->orupper)
return;
if (!tty_pane_full_width(tty, ctx) ||
- tty_fake_bce(tty, ctx->wp, 8) ||
+ tty_fake_bce(tty, wp, 8) ||
!tty_term_has(tty->term, TTYC_CSR) ||
!tty_term_has(tty->term, TTYC_RI)) {
tty_redraw_region(tty, ctx);
return;
}
- tty_attributes(tty, &grid_default_cell, ctx->wp);
+ tty_default_attributes(tty, wp, ctx->bg);
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
tty_margin_off(tty);
@@ -1176,7 +1180,7 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx)
return;
}
- tty_attributes(tty, &grid_default_cell, wp);
+ tty_default_attributes(tty, wp, ctx->bg);
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
tty_margin_pane(tty, ctx);
@@ -1207,7 +1211,7 @@ tty_cmd_scrollup(struct tty *tty, const struct tty_ctx *ctx)
return;
}
- tty_attributes(tty, &grid_default_cell, wp);
+ tty_default_attributes(tty, wp, ctx->bg);
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
tty_margin_pane(tty, ctx);
diff --git a/window-copy.c b/window-copy.c
index 424ca28d..6d1a9f69 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -321,7 +321,7 @@ window_copy_vadd(struct window_pane *wp, const char *fmt, va_list ap)
* (so it's on a new line).
*/
screen_write_carriagereturn(&back_ctx);
- screen_write_linefeed(&back_ctx, 0);
+ screen_write_linefeed(&back_ctx, 0, 8);
} else
data->backing_written = 1;
old_cy = backing->cy;