Implement mode set/reset. Implement DECCKM mode.
This commit is contained in:
parent
334d6cb08b
commit
b1622413a9
@ -204,6 +204,12 @@ struct guac_terminal {
|
|||||||
*/
|
*/
|
||||||
int selection_end_column;
|
int selection_end_column;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the cursor (arrow) keys should send cursor sequences
|
||||||
|
* or application sequences (DECCKM).
|
||||||
|
*/
|
||||||
|
bool application_cursor_keys;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -298,10 +298,30 @@ int ssh_guac_client_key_handler(guac_client* client, int keysym, int pressed) {
|
|||||||
else if (keysym == 0xFF1B) { data = "\x1B"; length = 1; }
|
else if (keysym == 0xFF1B) { data = "\x1B"; length = 1; }
|
||||||
|
|
||||||
/* Arrow keys */
|
/* Arrow keys */
|
||||||
else if (keysym == 0xFF52) { data = "\x1B\x5B""A"; length = 3; }
|
else if (keysym == 0xFF52) {
|
||||||
else if (keysym == 0xFF54) { data = "\x1B\x5B""B"; length = 3; }
|
if (term->application_cursor_keys) data = "\x1BOA";
|
||||||
else if (keysym == 0xFF53) { data = "\x1B\x5B""C"; length = 3; }
|
else data = "\x1B[A";
|
||||||
else if (keysym == 0xFF51) { data = "\x1B\x5B""D"; length = 3; }
|
length = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (keysym == 0xFF54) {
|
||||||
|
if (term->application_cursor_keys) data = "\x1BOB";
|
||||||
|
else data = "\x1B[B";
|
||||||
|
length = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (keysym == 0xFF53) {
|
||||||
|
if (term->application_cursor_keys) data = "\x1BOC";
|
||||||
|
else data = "\x1B[C";
|
||||||
|
length = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (keysym == 0xFF51) {
|
||||||
|
if (term->application_cursor_keys) data = "\x1BOD";
|
||||||
|
else data = "\x1B[D";
|
||||||
|
length = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Ignore other keys */
|
/* Ignore other keys */
|
||||||
else return 0;
|
else return 0;
|
||||||
|
@ -95,6 +95,7 @@ guac_terminal* guac_terminal_create(guac_client* client,
|
|||||||
term->scroll_end = term->term_height - 1;
|
term->scroll_end = term->term_height - 1;
|
||||||
|
|
||||||
term->text_selected = false;
|
term->text_selected = false;
|
||||||
|
term->application_cursor_keys = false;
|
||||||
|
|
||||||
/* Open STDOUT pipe */
|
/* Open STDOUT pipe */
|
||||||
if (pipe(term->stdout_pipe_fd)) {
|
if (pipe(term->stdout_pipe_fd)) {
|
||||||
|
@ -284,6 +284,9 @@ int guac_terminal_csi(guac_terminal* term, char c) {
|
|||||||
static int argc = 0;
|
static int argc = 0;
|
||||||
static int argv[16] = {0};
|
static int argv[16] = {0};
|
||||||
|
|
||||||
|
/* Whether the sequence started with a question mark */
|
||||||
|
static bool initial_question_mark = false;
|
||||||
|
|
||||||
/* Argument building counter and buffer */
|
/* Argument building counter and buffer */
|
||||||
static int argv_length = 0;
|
static int argv_length = 0;
|
||||||
static char argv_buffer[256];
|
static char argv_buffer[256];
|
||||||
@ -553,6 +556,34 @@ int guac_terminal_csi(guac_terminal* term, char c) {
|
|||||||
term->cursor_row = row;
|
term->cursor_row = row;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* h: Set Mode */
|
||||||
|
case 'h':
|
||||||
|
|
||||||
|
/* DECCKM */
|
||||||
|
if (argv[0] == 1)
|
||||||
|
term->application_cursor_keys = true;
|
||||||
|
|
||||||
|
else
|
||||||
|
guac_client_log_info(term->client,
|
||||||
|
"Unhandled mode set: mode=%i, initial_question_mark=%i",
|
||||||
|
argv[0], initial_question_mark);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* l: Reset Mode */
|
||||||
|
case 'l':
|
||||||
|
|
||||||
|
/* DECCKM */
|
||||||
|
if (argv[0] == 1)
|
||||||
|
term->application_cursor_keys = false;
|
||||||
|
|
||||||
|
else
|
||||||
|
guac_client_log_info(term->client,
|
||||||
|
"Unhandled mode reset: mode=%i, initial_question_mark=%i",
|
||||||
|
argv[0], initial_question_mark);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
/* m: Set graphics rendition */
|
/* m: Set graphics rendition */
|
||||||
case 'm':
|
case 'm':
|
||||||
|
|
||||||
@ -659,6 +690,9 @@ int guac_terminal_csi(guac_terminal* term, char c) {
|
|||||||
for (i=0; i<argc; i++)
|
for (i=0; i<argc; i++)
|
||||||
argv[i] = 0;
|
argv[i] = 0;
|
||||||
|
|
||||||
|
/* Reset mark flag */
|
||||||
|
initial_question_mark = false;
|
||||||
|
|
||||||
/* Reset argument counters */
|
/* Reset argument counters */
|
||||||
argc = 0;
|
argc = 0;
|
||||||
argv_length = 0;
|
argv_length = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user