Clear cells when resizing or scrolling.
This commit is contained in:
parent
6092badb3b
commit
3a50c9572d
@ -410,9 +410,14 @@ void guac_terminal_display_resize(guac_terminal_display* display, int width, int
|
||||
guac_terminal_operation* current;
|
||||
int x, y;
|
||||
|
||||
/* Set width and height */
|
||||
display->width = width;
|
||||
display->height = height;
|
||||
/* Fill with background color (index 0) */
|
||||
guac_terminal_char fill = {
|
||||
.value = ' ',
|
||||
.attributes = {
|
||||
.foreground = 0,
|
||||
.background = 0
|
||||
}
|
||||
};
|
||||
|
||||
/* Free old operations buffer */
|
||||
if (display->operations != NULL)
|
||||
@ -427,19 +432,34 @@ void guac_terminal_display_resize(guac_terminal_display* display, int width, int
|
||||
for (y=0; y<height; y++) {
|
||||
|
||||
/* Init entire row to NOP */
|
||||
for (x=0; x<width; x++)
|
||||
(current++)->type = GUAC_CHAR_NOP;
|
||||
for (x=0; x<width; x++) {
|
||||
|
||||
/* If on old part of screen, do not clear */
|
||||
if (x < display->width && y < display->height)
|
||||
current->type = GUAC_CHAR_NOP;
|
||||
|
||||
/* Otherwise, clear contents first */
|
||||
else {
|
||||
current->type = GUAC_CHAR_SET;
|
||||
current->character = fill;
|
||||
}
|
||||
|
||||
current++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Set width and height */
|
||||
display->width = width;
|
||||
display->height = height;
|
||||
|
||||
/* Send initial display size */
|
||||
guac_protocol_send_size(display->client->socket,
|
||||
GUAC_DEFAULT_LAYER,
|
||||
display->char_width * width,
|
||||
display->char_height * height);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void __guac_terminal_display_flush_copy(guac_terminal_display* display) {
|
||||
|
@ -162,8 +162,21 @@ int guac_terminal_write(guac_terminal* term, const char* c, int size) {
|
||||
int guac_terminal_scroll_up(guac_terminal* term,
|
||||
int start_row, int end_row, int amount) {
|
||||
|
||||
/* Copy row data upwards */
|
||||
guac_terminal_copy_rows(term, start_row + amount, end_row, -amount);
|
||||
/* If scrolling entire display, update scroll offset */
|
||||
if (start_row == 0 && end_row == term->term_height - 1) {
|
||||
|
||||
/* Scroll up visibly */
|
||||
guac_terminal_display_copy_rows(term->display, start_row + amount, end_row, -amount);
|
||||
|
||||
/* Advance by scroll amount */
|
||||
term->buffer->top += amount;
|
||||
term->buffer->length += amount;
|
||||
|
||||
}
|
||||
|
||||
/* Otherwise, just copy row data upwards */
|
||||
else
|
||||
guac_terminal_copy_rows(term, start_row + amount, end_row, -amount);
|
||||
|
||||
/* Clear new area */
|
||||
guac_terminal_clear_range(term,
|
||||
@ -274,8 +287,11 @@ void guac_terminal_scroll_display_down(guac_terminal* terminal,
|
||||
guac_terminal_buffer_row* buffer_row =
|
||||
guac_terminal_buffer_get_row(terminal->buffer, row, 0);
|
||||
|
||||
/* Clear row */
|
||||
guac_terminal_display_set_columns(terminal->display,
|
||||
dest_row, 0, terminal->display->width, &(terminal->default_char));
|
||||
|
||||
/* Draw row */
|
||||
/* FIXME: Clear row first */
|
||||
guac_terminal_char* current = buffer_row->characters;
|
||||
for (column=0; column<buffer_row->length; column++)
|
||||
guac_terminal_display_set_columns(terminal->display,
|
||||
@ -329,8 +345,11 @@ void guac_terminal_scroll_display_up(guac_terminal* terminal,
|
||||
guac_terminal_buffer_row* buffer_row =
|
||||
guac_terminal_buffer_get_row(terminal->buffer, row, 0);
|
||||
|
||||
/* Clear row */
|
||||
guac_terminal_display_set_columns(terminal->display,
|
||||
dest_row, 0, terminal->display->width, &(terminal->default_char));
|
||||
|
||||
/* Draw row */
|
||||
/* FIXME: Clear row first */
|
||||
guac_terminal_char* current = buffer_row->characters;
|
||||
for (column=0; column<buffer_row->length; column++)
|
||||
guac_terminal_display_set_columns(terminal->display,
|
||||
|
Loading…
Reference in New Issue
Block a user