Allow screen_dirty_line_graphics to be used with either main or alt buffers
This commit is contained in:
parent
7f6f1f9a5d
commit
c40333a8a7
1 changed files with 10 additions and 9 deletions
|
|
@ -892,18 +892,19 @@ cursor_within_margins(Screen *self) {
|
|||
// as dirty (like screen_insert_lines) and at the same time don't move image
|
||||
// references (i.e. unlike screen_scroll, which moves everything).
|
||||
static void
|
||||
screen_dirty_line_graphics(Screen *self, unsigned int top, unsigned int bottom) {
|
||||
screen_dirty_line_graphics(Screen *self, unsigned int top, unsigned int bottom, bool main_buf) {
|
||||
bool need_to_remove = false;
|
||||
bottom = MIN(bottom+1, self->lines);
|
||||
LineBuf *linebuf = main_buf ? self->main_linebuf : self->alt_linebuf;
|
||||
for (unsigned int y = top; y < bottom; y++) {
|
||||
if (self->linebuf->line_attrs[y].has_image_placeholders) {
|
||||
if (linebuf->line_attrs[y].has_image_placeholders) {
|
||||
need_to_remove = true;
|
||||
linebuf_mark_line_dirty(self->linebuf, y);
|
||||
linebuf_mark_line_dirty(linebuf, y);
|
||||
self->is_dirty = true;
|
||||
}
|
||||
}
|
||||
if (need_to_remove)
|
||||
grman_remove_cell_images(self->grman, top, bottom);
|
||||
grman_remove_cell_images(main_buf ? self->main_grman : self->alt_grman, top, bottom);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -919,7 +920,7 @@ screen_handle_graphics_command(Screen *self, const GraphicsCommand *cmd, const u
|
|||
}
|
||||
if (cmd->unicode_placement) {
|
||||
// Make sure the placeholders are redrawn if we add or change a virtual placement.
|
||||
screen_dirty_line_graphics(self, 0, self->lines);
|
||||
screen_dirty_line_graphics(self, 0, self->lines, self->linebuf == self->main_linebuf);
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
|
@ -1607,7 +1608,7 @@ screen_erase_in_line(Screen *self, unsigned int how, bool private) {
|
|||
break;
|
||||
}
|
||||
if (n > 0) {
|
||||
screen_dirty_line_graphics(self, self->cursor->y, self->cursor->y);
|
||||
screen_dirty_line_graphics(self, self->cursor->y, self->cursor->y, self->linebuf == self->main_linebuf);
|
||||
linebuf_init_line(self->linebuf, self->cursor->y);
|
||||
if (private) {
|
||||
line_clear_text(self->linebuf->line, s, n, BLANK_CHAR);
|
||||
|
|
@ -1684,7 +1685,7 @@ screen_erase_in_display(Screen *self, unsigned int how, bool private) {
|
|||
return;
|
||||
}
|
||||
if (b > a) {
|
||||
if (how != 3) screen_dirty_line_graphics(self, a, b);
|
||||
if (how != 3) screen_dirty_line_graphics(self, a, b, self->linebuf == self->main_linebuf);
|
||||
for (unsigned int i=a; i < b; i++) {
|
||||
linebuf_init_line(self->linebuf, i);
|
||||
if (private) {
|
||||
|
|
@ -1712,7 +1713,7 @@ screen_insert_lines(Screen *self, unsigned int count) {
|
|||
unsigned int top = self->margin_top, bottom = self->margin_bottom;
|
||||
if (count == 0) count = 1;
|
||||
if (top <= self->cursor->y && self->cursor->y <= bottom) {
|
||||
screen_dirty_line_graphics(self, top, bottom);
|
||||
screen_dirty_line_graphics(self, top, bottom, self->linebuf == self->main_linebuf);
|
||||
linebuf_insert_lines(self->linebuf, count, self->cursor->y, bottom);
|
||||
self->is_dirty = true;
|
||||
clear_selection(&self->selections);
|
||||
|
|
@ -1738,7 +1739,7 @@ screen_delete_lines(Screen *self, unsigned int count) {
|
|||
unsigned int top = self->margin_top, bottom = self->margin_bottom;
|
||||
if (count == 0) count = 1;
|
||||
if (top <= self->cursor->y && self->cursor->y <= bottom) {
|
||||
screen_dirty_line_graphics(self, top, bottom);
|
||||
screen_dirty_line_graphics(self, top, bottom, self->linebuf == self->main_linebuf);
|
||||
linebuf_delete_lines(self->linebuf, count, self->cursor->y, bottom);
|
||||
self->is_dirty = true;
|
||||
clear_selection(&self->selections);
|
||||
|
|
|
|||
Loading…
Reference in a new issue