mirror of
https://github.com/tmux/tmux.git
synced 2026-08-28 17:41:35 +00:00
Clear text beneath graphical images
This commit is contained in:
29
tty-draw.c
29
tty-draw.c
@@ -29,7 +29,6 @@ enum tty_draw_line_state {
|
||||
TTY_DRAW_LINE_NEW1,
|
||||
TTY_DRAW_LINE_NEW2,
|
||||
TTY_DRAW_LINE_EMPTY,
|
||||
TTY_DRAW_LINE_IMAGE,
|
||||
TTY_DRAW_LINE_SAME,
|
||||
TTY_DRAW_LINE_DONE
|
||||
};
|
||||
@@ -39,7 +38,6 @@ static const char* tty_draw_line_states[] = {
|
||||
"NEW1",
|
||||
"NEW2",
|
||||
"EMPTY",
|
||||
"IMAGE",
|
||||
"SAME",
|
||||
"DONE"
|
||||
};
|
||||
@@ -132,7 +130,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
||||
struct grid_line *gl;
|
||||
u_int i, j, last_i, cx, ex, width;
|
||||
u_int cellsize, bg;
|
||||
int flags, empty, skip, wrapped = 0;
|
||||
int flags, empty, wrapped = 0;
|
||||
char buf[1000];
|
||||
size_t len;
|
||||
enum tty_draw_line_state current_state, next_state;
|
||||
@@ -237,8 +235,6 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
||||
width = 0;
|
||||
current_state = TTY_DRAW_LINE_FIRST;
|
||||
for (;;) {
|
||||
skip = 0;
|
||||
|
||||
/* Work out the next state. */
|
||||
if (i == nx) {
|
||||
/*
|
||||
@@ -269,17 +265,13 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
||||
memcpy(&image_gc, &gc,
|
||||
sizeof image_gc);
|
||||
utf8_set(&image_gc.data, ' ');
|
||||
image_gc.flags &=
|
||||
~GRID_FLAG_IMAGE;
|
||||
skip = 1;
|
||||
image_gc.flags &= ~(GRID_FLAG_IMAGE|
|
||||
GRID_FLAG_SELECTED);
|
||||
} else {
|
||||
image_get_fallback_cell(tty, im,
|
||||
gc.image_x, gc.image_y, &gc,
|
||||
&image_gc, style_ctx);
|
||||
}
|
||||
if (skip)
|
||||
image_gc.flags &=
|
||||
~GRID_FLAG_SELECTED;
|
||||
gcp = &image_gc;
|
||||
} else
|
||||
gcp = &gc;
|
||||
@@ -288,12 +280,8 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
||||
#endif
|
||||
|
||||
/* Work out empty cells. */
|
||||
if (skip)
|
||||
empty = 0;
|
||||
else
|
||||
empty = tty_draw_line_get_empty(gcp,
|
||||
&last, nx - i);
|
||||
if (empty != 0 || skip)
|
||||
empty = tty_draw_line_get_empty(gcp, &last, nx - i);
|
||||
if (empty != 0)
|
||||
;
|
||||
else {
|
||||
/* Update for codeset if needed. */
|
||||
@@ -310,9 +298,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
||||
}
|
||||
|
||||
/* Work out the next state. */
|
||||
if (skip)
|
||||
next_state = TTY_DRAW_LINE_IMAGE;
|
||||
else if (empty != 0)
|
||||
if (empty != 0)
|
||||
next_state = TTY_DRAW_LINE_EMPTY;
|
||||
else if (current_state == TTY_DRAW_LINE_FIRST)
|
||||
next_state = TTY_DRAW_LINE_SAME;
|
||||
@@ -359,8 +345,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
||||
}
|
||||
|
||||
/* Append the cell if it is not empty and not padding. */
|
||||
if (next_state != TTY_DRAW_LINE_EMPTY &&
|
||||
next_state != TTY_DRAW_LINE_IMAGE) {
|
||||
if (next_state != TTY_DRAW_LINE_EMPTY) {
|
||||
memcpy(buf + len, gcp->data.data, gcp->data.size);
|
||||
len += gcp->data.size;
|
||||
width += gcp->data.width;
|
||||
|
||||
Reference in New Issue
Block a user