mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Redraw selection in tty_draw_line, so it appears when redrawing whole
pane. Reported by Theo Buehler.
This commit is contained in:
parent
68bebe1fb7
commit
4160df4ca4
@ -1141,12 +1141,8 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
|||||||
|
|
||||||
/* Write to the screen. */
|
/* Write to the screen. */
|
||||||
if (selected) {
|
if (selected) {
|
||||||
memcpy(&tmp_gc, &s->sel.cell, sizeof tmp_gc);
|
|
||||||
utf8_copy(&tmp_gc.data, &gc->data);
|
|
||||||
tmp_gc.attr = tmp_gc.attr & ~GRID_ATTR_CHARSET;
|
|
||||||
tmp_gc.attr |= gc->attr & GRID_ATTR_CHARSET;
|
|
||||||
tmp_gc.flags = gc->flags;
|
|
||||||
screen_write_flush(ctx);
|
screen_write_flush(ctx);
|
||||||
|
screen_select_cell(s, &tmp_gc, gc);
|
||||||
ttyctx.cell = &tmp_gc;
|
ttyctx.cell = &tmp_gc;
|
||||||
tty_write(tty_cmd_cell, &ttyctx);
|
tty_write(tty_cmd_cell, &ttyctx);
|
||||||
ctx->written++;
|
ctx->written++;
|
||||||
|
16
screen.c
16
screen.c
@ -371,6 +371,22 @@ screen_check_selection(struct screen *s, u_int px, u_int py)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get selected grid cell. */
|
||||||
|
void
|
||||||
|
screen_select_cell(struct screen *s, struct grid_cell *dst,
|
||||||
|
const struct grid_cell *src)
|
||||||
|
{
|
||||||
|
if (!s->sel.flag)
|
||||||
|
return;
|
||||||
|
|
||||||
|
memcpy(dst, &s->sel.cell, sizeof *dst);
|
||||||
|
|
||||||
|
utf8_copy(&dst->data, &src->data);
|
||||||
|
dst->attr = dst->attr & ~GRID_ATTR_CHARSET;
|
||||||
|
dst->attr |= src->attr & GRID_ATTR_CHARSET;
|
||||||
|
dst->flags = src->flags;
|
||||||
|
}
|
||||||
|
|
||||||
/* Reflow wrapped lines. */
|
/* Reflow wrapped lines. */
|
||||||
static void
|
static void
|
||||||
screen_reflow(struct screen *s, u_int new_x)
|
screen_reflow(struct screen *s, u_int new_x)
|
||||||
|
2
tmux.h
2
tmux.h
@ -2060,6 +2060,8 @@ void screen_set_selection(struct screen *,
|
|||||||
u_int, u_int, u_int, u_int, u_int, struct grid_cell *);
|
u_int, u_int, u_int, u_int, u_int, struct grid_cell *);
|
||||||
void screen_clear_selection(struct screen *);
|
void screen_clear_selection(struct screen *);
|
||||||
int screen_check_selection(struct screen *, u_int, u_int);
|
int screen_check_selection(struct screen *, u_int, u_int);
|
||||||
|
void screen_select_cell(struct screen *, struct grid_cell *,
|
||||||
|
const struct grid_cell *);
|
||||||
|
|
||||||
/* window.c */
|
/* window.c */
|
||||||
extern struct windows windows;
|
extern struct windows windows;
|
||||||
|
8
tty.c
8
tty.c
@ -658,7 +658,7 @@ void
|
|||||||
tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
||||||
struct screen *s, u_int py, u_int ox, u_int oy)
|
struct screen *s, u_int py, u_int ox, u_int oy)
|
||||||
{
|
{
|
||||||
struct grid_cell gc;
|
struct grid_cell gc, tmp_gc;
|
||||||
struct grid_line *gl;
|
struct grid_line *gl;
|
||||||
u_int i, sx;
|
u_int i, sx;
|
||||||
int flags;
|
int flags;
|
||||||
@ -687,7 +687,11 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
|||||||
|
|
||||||
for (i = 0; i < sx; i++) {
|
for (i = 0; i < sx; i++) {
|
||||||
grid_view_get_cell(s->grid, i, py, &gc);
|
grid_view_get_cell(s->grid, i, py, &gc);
|
||||||
tty_cell(tty, &gc, wp);
|
if (gc.flags & GRID_FLAG_SELECTED) {
|
||||||
|
screen_select_cell(s, &tmp_gc, &gc);
|
||||||
|
tty_cell(tty, &tmp_gc, wp);
|
||||||
|
} else
|
||||||
|
tty_cell(tty, &gc, wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sx < tty->sx) {
|
if (sx < tty->sx) {
|
||||||
|
Loading…
Reference in New Issue
Block a user