Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions src/terminal/terminal-handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,7 @@ int guac_terminal_set_directory(guac_terminal* term, unsigned char c) {
static char filename[2048];
static int length = 0;

/* Stop on ECMA-48 ST (String Terminator */
/* Stop on ECMA-48 ST (String Terminator) */
if (c == 0x9C || c == 0x5C || c == 0x07) {
filename[length++] = '\0';
term->char_handler = guac_terminal_echo;
Expand All @@ -1334,7 +1334,7 @@ int guac_terminal_download(guac_terminal* term, unsigned char c) {
static char filename[2048];
static int length = 0;

/* Stop on ECMA-48 ST (String Terminator */
/* Stop on ECMA-48 ST (String Terminator) */
if (c == 0x9C || c == 0x5C || c == 0x07) {
filename[length++] = '\0';
term->char_handler = guac_terminal_echo;
Expand Down Expand Up @@ -1456,7 +1456,7 @@ int guac_terminal_window_title(guac_terminal* term, unsigned char c) {

guac_socket* socket = term->client->socket;

/* Stop on ECMA-48 ST (String Terminator */
/* Stop on ECMA-48 ST (String Terminator) */
if (c == 0x9C || c == 0x5C || c == 0x07) {

/* Terminate and reset stored title */
Expand Down Expand Up @@ -1552,14 +1552,22 @@ int guac_terminal_xterm_palette(guac_terminal* term, unsigned char c) {

}

/* Stop on ECMA-48 ST (String Terminator */
/* 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_unknown_osc(guac_terminal* term, unsigned char c) {
Comment thread
andywarduk marked this conversation as resolved.
/* 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) {

static int operation = 0;
Expand Down Expand Up @@ -1599,12 +1607,16 @@ int guac_terminal_osc(guac_terminal* term, unsigned char c) {
else if (operation == 4)
term->char_handler = guac_terminal_xterm_palette;

/* Unknown OSC */
else
term->char_handler = guac_terminal_unknown_osc;

/* Reset parameter for next OSC */
operation = 0;

}

/* Stop on ECMA-48 ST (String Terminator */
/* Stop on ECMA-48 ST (String Terminator) */
else if (c == 0x9C || c == 0x5C || c == 0x07)
term->char_handler = guac_terminal_echo;

Expand Down
15 changes: 15 additions & 0 deletions src/terminal/terminal/terminal-handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,21 @@ int guac_terminal_window_title(guac_terminal* term, unsigned char c);
*/
int guac_terminal_xterm_palette(guac_terminal* term, unsigned char c);

/**
* Handles the remaining characters of an unrecognized OSC sequence, discarding
* them until the sequence is terminated. OSC sequences are terminated by either
* the ECMA-48 String Terminator (ST), which may appear as ESC \ (0x1B 0x5C),
* the single-character ST (0x9C), or BEL (0x07). This handler is used when the
* OSC operation code is not recognized by the terminal emulator.
*
* @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_unknown_osc(guac_terminal* term, unsigned char c);

/**
* Handles the remaining characters of an Operating System Code (OSC) sequence,
* typically initiated with "ESC ]".
Expand Down
Loading