GUACAMOLE-278: Handle (but ignore) xterm's 256-color palette redefinition OSC.

This commit is contained in:
Michael Jumper 2017-04-23 13:59:03 -07:00
parent e4ce7b0eeb
commit 10180095d8
2 changed files with 29 additions and 0 deletions

View File

@ -138,6 +138,18 @@ int guac_terminal_open_pipe_stream(guac_terminal* term, unsigned char c);
*/ */
int guac_terminal_close_pipe_stream(guac_terminal* term, unsigned char c); int guac_terminal_close_pipe_stream(guac_terminal* term, unsigned char c);
/**
* Parses the remainder of xterm's OSC sequence for redefining the terminal
* emulator's palette.
*
* @param term
* The terminal that received the given character of data.
*
* @param c
* The character that was received by the given terminal.
*/
int guac_terminal_xterm_palette(guac_terminal* term, unsigned char c);
/** /**
* Handles the remaining characters of an Operating System Code (OSC) sequence, * Handles the remaining characters of an Operating System Code (OSC) sequence,
* typically initiated with "ESC ]". * typically initiated with "ESC ]".

View File

@ -1156,6 +1156,19 @@ int guac_terminal_close_pipe_stream(guac_terminal* term, unsigned char c) {
} }
int guac_terminal_xterm_palette(guac_terminal* term, unsigned char c) {
/* NOTE: Currently unimplemented. Attempts to set the 256-color palette
* are ignored. */
/* Stop on ECMA-48 ST (String Terminator */
if (c == 0x9C || c == 0x5C || c == 0x07)
term->char_handler = guac_terminal_echo;
return 0;
}
int guac_terminal_osc(guac_terminal* term, unsigned char c) { int guac_terminal_osc(guac_terminal* term, unsigned char c) {
static int operation = 0; static int operation = 0;
@ -1183,6 +1196,10 @@ int guac_terminal_osc(guac_terminal* term, unsigned char c) {
else if (operation == 482203) else if (operation == 482203)
term->char_handler = guac_terminal_close_pipe_stream; term->char_handler = guac_terminal_close_pipe_stream;
/* xterm 256-color palette redefinition */
else if (operation == 4)
term->char_handler = guac_terminal_xterm_palette;
/* Reset parameter for next OSC */ /* Reset parameter for next OSC */
operation = 0; operation = 0;