mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Cache selected state so that cells going from selected to unselected are not
skipped, reported by Omar Sandoval.
This commit is contained in:
parent
00cf5fbde6
commit
aba4438013
@ -989,8 +989,19 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
|||||||
if (skip)
|
if (skip)
|
||||||
skip = (memcmp(&now_gc, gc, sizeof now_gc) == 0);
|
skip = (memcmp(&now_gc, gc, sizeof now_gc) == 0);
|
||||||
|
|
||||||
/* Set the cell. */
|
/* Update the selection the flag and set the cell. */
|
||||||
if (!skip)
|
selected = screen_check_selection(s, s->cx, s->cy);
|
||||||
|
if (selected && ~gc->flags & GRID_FLAG_SELECTED) {
|
||||||
|
skip = 0;
|
||||||
|
memcpy(&tmp_gc, gc, sizeof tmp_gc);
|
||||||
|
tmp_gc.flags |= GRID_FLAG_SELECTED;
|
||||||
|
grid_view_set_cell(gd, s->cx, s->cy, &tmp_gc);
|
||||||
|
} else if (!selected && gc->flags & GRID_FLAG_SELECTED) {
|
||||||
|
skip = 0;
|
||||||
|
memcpy(&tmp_gc, gc, sizeof tmp_gc);
|
||||||
|
tmp_gc.flags &= ~GRID_FLAG_SELECTED;
|
||||||
|
grid_view_set_cell(gd, s->cx, s->cy, &tmp_gc);
|
||||||
|
} else if (!skip)
|
||||||
grid_view_set_cell(gd, s->cx, s->cy, gc);
|
grid_view_set_cell(gd, s->cx, s->cy, gc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1009,11 +1020,6 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
|||||||
tty_write(tty_cmd_insertcharacter, &ttyctx);
|
tty_write(tty_cmd_insertcharacter, &ttyctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if this is selected. */
|
|
||||||
selected = screen_check_selection(s, s->cx - width, s->cy);
|
|
||||||
if (selected)
|
|
||||||
skip = 0;
|
|
||||||
|
|
||||||
/* Save last cell if it will be needed. */
|
/* Save last cell if it will be needed. */
|
||||||
if (!skip && ctx->wp != NULL && ttyctx.ocx > ctx->wp->sx - width)
|
if (!skip && ctx->wp != NULL && ttyctx.ocx > ctx->wp->sx - width)
|
||||||
screen_write_save_last(ctx, &ttyctx);
|
screen_write_save_last(ctx, &ttyctx);
|
||||||
|
1
tmux.h
1
tmux.h
@ -642,6 +642,7 @@ enum utf8_state {
|
|||||||
#define GRID_FLAG_EXTENDED 0x8
|
#define GRID_FLAG_EXTENDED 0x8
|
||||||
#define GRID_FLAG_FGRGB 0x10
|
#define GRID_FLAG_FGRGB 0x10
|
||||||
#define GRID_FLAG_BGRGB 0x20
|
#define GRID_FLAG_BGRGB 0x20
|
||||||
|
#define GRID_FLAG_SELECTED 0x40
|
||||||
|
|
||||||
/* Grid line flags. */
|
/* Grid line flags. */
|
||||||
#define GRID_LINE_WRAPPED 0x1
|
#define GRID_LINE_WRAPPED 0x1
|
||||||
|
Loading…
Reference in New Issue
Block a user