Add some Linux-specific missing codes, reorder SGR. Add explicit ignores for unapplicable features.

This commit is contained in:
Michael Jumper 2013-05-24 15:00:54 -07:00
parent e0c46a41a2
commit 7216f734b5

View File

@ -502,6 +502,7 @@ int guac_terminal_csi(guac_terminal* term, char c) {
break; break;
/* G: Move cursor, current row */ /* G: Move cursor, current row */
case '`':
case 'G': case 'G':
col = argv[0]; if (col != 0) col--; col = argv[0]; if (col != 0) col--;
term->cursor_col = col; term->cursor_col = col;
@ -612,6 +613,11 @@ int guac_terminal_csi(guac_terminal* term, char c) {
break; break;
/* ]: Linux Private CSI */
case ']':
/* Explicitly ignored */
break;
/* c: Identify */ /* c: Identify */
case 'c': case 'c':
guac_terminal_write_all(term->stdin_pipe_fd[1], "\x1B[?6c", 5); guac_terminal_write_all(term->stdin_pipe_fd[1], "\x1B[?6c", 5);
@ -672,14 +678,26 @@ int guac_terminal_csi(guac_terminal* term, char c) {
else if (value == 4) else if (value == 4)
term->current_attributes.underscore = true; term->current_attributes.underscore = true;
/* Reverse video */
else if (value == 7)
term->current_attributes.reverse = true;
/* Normal intensity (not bold) */
else if (value == 21 || value == 22)
term->current_attributes.bold = false;
/* Reset underscore */
else if (value == 24)
term->current_attributes.underscore = false;
/* Reset reverse video */
else if (value == 27)
term->current_attributes.reverse = false;
/* Foreground */ /* Foreground */
else if (value >= 30 && value <= 37) else if (value >= 30 && value <= 37)
term->current_attributes.foreground = value - 30; term->current_attributes.foreground = value - 30;
/* Background */
else if (value >= 40 && value <= 47)
term->current_attributes.background = value - 40;
/* Underscore on, default foreground */ /* Underscore on, default foreground */
else if (value == 38) { else if (value == 38) {
term->current_attributes.underscore = true; term->current_attributes.underscore = true;
@ -694,23 +712,15 @@ int guac_terminal_csi(guac_terminal* term, char c) {
term->default_char.attributes.foreground; term->default_char.attributes.foreground;
} }
/* Background */
else if (value >= 40 && value <= 47)
term->current_attributes.background = value - 40;
/* Reset background */ /* Reset background */
else if (value == 49) else if (value == 49)
term->current_attributes.background = term->current_attributes.background =
term->default_char.attributes.background; term->default_char.attributes.background;
/* Reverse video */
else if (value == 7)
term->current_attributes.reverse = true;
/* Reset underscore */
else if (value == 24)
term->current_attributes.underscore = false;
/* Reset reverse video */
else if (value == 27)
term->current_attributes.reverse = false;
else else
guac_client_log_info(term->client, guac_client_log_info(term->client,
"Unhandled graphics rendition: %i", value); "Unhandled graphics rendition: %i", value);
@ -719,6 +729,11 @@ int guac_terminal_csi(guac_terminal* term, char c) {
break; break;
/* q: Set keyboard LEDs */
case 'q':
/* Explicitly ignored */
break;
/* r: Set scrolling region */ /* r: Set scrolling region */
case 'r': case 'r':
@ -736,6 +751,26 @@ int guac_terminal_csi(guac_terminal* term, char c) {
break; break;
/* Save Cursor */
case 's':
term->saved_cursor_row = term->cursor_row;
term->saved_cursor_col = term->cursor_col;
break;
/* Restore Cursor */
case 'u':
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;
/* Warn of unhandled codes */ /* Warn of unhandled codes */
default: default:
if (c != ';') { if (c != ';') {