Add LF/NL mode.

This commit is contained in:
Michael Jumper 2013-05-24 13:33:32 -07:00
parent e3f89052e5
commit b513e4ba93
3 changed files with 20 additions and 5 deletions

View File

@ -210,6 +210,11 @@ struct guac_terminal {
*/
bool application_cursor_keys;
/**
* Whether a CR should automatically follow a LF, VT, or FF.
*/
bool automatic_carriage_return;
};
/**

View File

@ -96,6 +96,7 @@ guac_terminal* guac_terminal_create(guac_client* client,
term->text_selected = false;
term->application_cursor_keys = false;
term->automatic_carriage_return = false;
/* Open STDOUT pipe */
if (pipe(term->stdout_pipe_fd)) {

View File

@ -98,11 +98,6 @@ int guac_terminal_echo(guac_terminal* term, char c) {
term->cursor_col--;
break;
/* Carriage return */
case '\r':
term->cursor_col = 0;
break;
/* Line feed / VT / FF */
case '\n':
case 0x0B: /* VT */
@ -118,6 +113,14 @@ int guac_terminal_echo(guac_terminal* term, char c) {
term->scroll_end, 1);
}
/* If automatic carriage return, fall through to CR handler */
if (!term->automatic_carriage_return)
break;
/* Carriage return */
case '\r':
term->cursor_col = 0;
break;
/* ESC */
@ -333,6 +336,12 @@ static bool* __guac_terminal_get_flag(guac_terminal* term, int num, char private
}
}
else if (private_mode == 0) {
switch (num) {
case 20: return &(term->automatic_carriage_return); /* LF/NL */
}
}
/* Unknown flag */
return NULL;