Check write location on rect operations (copy, etc.)
This commit is contained in:
parent
342824914a
commit
7897be9316
@ -417,23 +417,28 @@ int guac_terminal_copy(guac_terminal* term,
|
|||||||
|
|
||||||
int scrolled_rows = rows;
|
int scrolled_rows = rows;
|
||||||
|
|
||||||
/* Adjust delta rect height if scrolled out of view */
|
|
||||||
if (scrolled_src_row + scrolled_rows > term->delta->height)
|
|
||||||
scrolled_rows = term->delta->height - scrolled_src_row;
|
|
||||||
|
|
||||||
if (scrolled_dst_row + scrolled_rows > term->delta->height)
|
|
||||||
scrolled_rows = term->delta->height - scrolled_dst_row;
|
|
||||||
|
|
||||||
/* FIXME: If source (but not dest) is partially scrolled out of view, then
|
/* FIXME: If source (but not dest) is partially scrolled out of view, then
|
||||||
* the delta will not be updated properly. We need to pull the data
|
* the delta will not be updated properly. We need to pull the data
|
||||||
* from the buffer in such a case.
|
* from the buffer in such a case.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Update delta */
|
if (scrolled_src_row < term->delta->height &&
|
||||||
guac_terminal_delta_copy(term->delta,
|
scrolled_dst_row < term->delta->height) {
|
||||||
scrolled_dst_row, dst_col,
|
|
||||||
scrolled_src_row, src_col,
|
/* Adjust delta rect height if scrolled out of view */
|
||||||
cols, rows);
|
if (scrolled_src_row + scrolled_rows > term->delta->height)
|
||||||
|
scrolled_rows = term->delta->height - scrolled_src_row;
|
||||||
|
|
||||||
|
if (scrolled_dst_row + scrolled_rows > term->delta->height)
|
||||||
|
scrolled_rows = term->delta->height - scrolled_dst_row;
|
||||||
|
|
||||||
|
/* Update delta */
|
||||||
|
guac_terminal_delta_copy(term->delta,
|
||||||
|
scrolled_dst_row, dst_col,
|
||||||
|
scrolled_src_row, src_col,
|
||||||
|
cols, rows);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* Update buffer */
|
/* Update buffer */
|
||||||
guac_terminal_buffer_copy(term->buffer,
|
guac_terminal_buffer_copy(term->buffer,
|
||||||
@ -452,18 +457,22 @@ int guac_terminal_clear(guac_terminal* term,
|
|||||||
int scrolled_row = row + term->scroll_offset;
|
int scrolled_row = row + term->scroll_offset;
|
||||||
int scrolled_rows = rows;
|
int scrolled_rows = rows;
|
||||||
|
|
||||||
/* Adjust delta rect height if scrolled out of view */
|
|
||||||
if (scrolled_row + scrolled_rows > term->delta->height)
|
|
||||||
scrolled_rows = term->delta->height - scrolled_row;
|
|
||||||
|
|
||||||
/* Build space */
|
/* Build space */
|
||||||
guac_terminal_char character;
|
guac_terminal_char character;
|
||||||
character.value = ' ';
|
character.value = ' ';
|
||||||
character.attributes = term->current_attributes;
|
character.attributes = term->current_attributes;
|
||||||
|
|
||||||
/* Fill with color */
|
if (scrolled_row < term->delta->height) {
|
||||||
guac_terminal_delta_set_rect(term->delta,
|
|
||||||
scrolled_row, col, cols, scrolled_rows, &character);
|
/* Adjust delta rect height if scrolled out of view */
|
||||||
|
if (scrolled_row + scrolled_rows > term->delta->height)
|
||||||
|
scrolled_rows = term->delta->height - scrolled_row;
|
||||||
|
|
||||||
|
/* Fill with color */
|
||||||
|
guac_terminal_delta_set_rect(term->delta,
|
||||||
|
scrolled_row, col, cols, scrolled_rows, &character);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
guac_terminal_buffer_set_rect(term->buffer,
|
guac_terminal_buffer_set_rect(term->buffer,
|
||||||
row, col, cols, rows, &character);
|
row, col, cols, rows, &character);
|
||||||
|
Loading…
Reference in New Issue
Block a user