Implement save/restore cursor.
This commit is contained in:
parent
c220a4875c
commit
b38412fd3d
@ -122,6 +122,16 @@ struct guac_terminal {
|
|||||||
*/
|
*/
|
||||||
int visible_cursor_col;
|
int visible_cursor_col;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The row of the saved cursor (ESC 7).
|
||||||
|
*/
|
||||||
|
int saved_cursor_row;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column of the saved cursor (ESC 7).
|
||||||
|
*/
|
||||||
|
int saved_cursor_col;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes which will be applied to future characters.
|
* The attributes which will be applied to future characters.
|
||||||
*/
|
*/
|
||||||
|
@ -83,8 +83,8 @@ guac_terminal* guac_terminal_create(guac_client* client,
|
|||||||
term->current_attributes = default_char.attributes;
|
term->current_attributes = default_char.attributes;
|
||||||
term->default_char = default_char;
|
term->default_char = default_char;
|
||||||
|
|
||||||
term->cursor_row = term->visible_cursor_row = 0;
|
term->cursor_row = term->visible_cursor_row = term->saved_cursor_row = 0;
|
||||||
term->cursor_col = term->visible_cursor_col = 0;
|
term->cursor_col = term->visible_cursor_col = term->saved_cursor_col = 0;
|
||||||
|
|
||||||
term->term_width = width / term->display->char_width;
|
term->term_width = width / term->display->char_width;
|
||||||
term->term_height = height / term->display->char_height;
|
term->term_height = height / term->display->char_height;
|
||||||
|
@ -172,6 +172,23 @@ int guac_terminal_escape(guac_terminal* term, char c) {
|
|||||||
term->char_handler = guac_terminal_csi;
|
term->char_handler = guac_terminal_csi;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case '7': /* Save Cursor (DECSC) */
|
||||||
|
term->saved_cursor_row = term->cursor_row;
|
||||||
|
term->saved_cursor_col = term->cursor_col;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '8': /* Restore Cursor (DECRC) */
|
||||||
|
|
||||||
|
term->cursor_row = term->saved_cursor_row;
|
||||||
|
if (term->cursor_row >= term->term_height)
|
||||||
|
term->cursor_row = term->term_height - 1;
|
||||||
|
|
||||||
|
term->cursor_col = term->saved_cursor_col;
|
||||||
|
if (term->cursor_col >= term->term_width)
|
||||||
|
term->cursor_col = term->term_width - 1;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case 'M': /* Reverse Linefeed */
|
case 'M': /* Reverse Linefeed */
|
||||||
|
|
||||||
term->cursor_row--;
|
term->cursor_row--;
|
||||||
|
Loading…
Reference in New Issue
Block a user