More CSI, moving to faster drawing technique.

This commit is contained in:
Michael Jumper 2011-08-10 11:03:38 -07:00
parent 52e14322a3
commit 31e8e8432a
3 changed files with 43 additions and 13 deletions

View File

@ -116,21 +116,30 @@ int ssh_guac_client_key_handler(guac_client* client, int keysym, int pressed) {
/* If key pressed */ /* If key pressed */
if (pressed) { if (pressed) {
char data;
/* If simple ASCII key */ /* If simple ASCII key */
if (keysym >= 0x00 && keysym <= 0xFF) if (keysym >= 0x00 && keysym <= 0xFF) {
data = (char) keysym; char data = (char) keysym;
else if (keysym == 0xFF08) data = 0x08;
else if (keysym == 0xFF09) data = 0x09;
else if (keysym == 0xFF0D) data = 0x0D;
else if (keysym == 0xFF1B) data = 0x1B;
else
return 0;
return channel_write(client_data->term_channel, &data, 1); return channel_write(client_data->term_channel, &data, 1);
}
else {
int length = 0;
const char* data = NULL;
if (keysym == 0xFF08) { data = "\x08"; length = 1; }
else if (keysym == 0xFF09) { data = "\x09"; length = 1; }
else if (keysym == 0xFF0D) { data = "\x0D"; length = 1; }
else if (keysym == 0xFF1B) { data = "\x1B"; length = 1; }
/* Arrow keys */
else if (keysym == 0xFF52) { data = "\x1B\x5B""A"; length = 3; }
else if (keysym == 0xFF54) { data = "\x1B\x5B""B"; length = 3; }
else if (keysym == 0xFF53) { data = "\x1B\x5B""C"; length = 3; }
else if (keysym == 0xFF51) { data = "\x1B\x5B""D"; length = 3; }
return channel_write(client_data->term_channel, data, length);
}
} }

View File

@ -286,7 +286,7 @@ int ssh_guac_terminal_set(ssh_guac_terminal* term, int row, int col,
} }
/* Set background */ /* Set background */
guac_send_rect(io, /*guac_send_rect(io,
GUAC_COMP_ROVER, GUAC_DEFAULT_LAYER, GUAC_COMP_ROVER, GUAC_DEFAULT_LAYER,
term->char_width * col, term->char_height * row, term->char_width * col, term->char_height * row,
@ -295,7 +295,7 @@ int ssh_guac_terminal_set(ssh_guac_terminal* term, int row, int col,
background_color->red, background_color->red,
background_color->green, background_color->green,
background_color->blue, background_color->blue,
255); 255);*/
return 0; return 0;

View File

@ -451,6 +451,27 @@ int ssh_guac_terminal_csi(ssh_guac_terminal* term, char c) {
break; break;
/* @: Insert characters (scroll right) */
case '@':
amount = argv[0];
if (amount == 0) amount = 1;
/* Scroll right by amount */
if (term->cursor_col + amount < term->term_width)
ssh_guac_terminal_copy(term,
term->cursor_row, term->cursor_col,
1, term->term_width - term->cursor_col - amount,
term->cursor_row, term->cursor_col + amount);
/* Clear left */
ssh_guac_terminal_clear(term,
term->cursor_row, term->cursor_col,
1, amount,
term->background);
break;
/* Warn of unhandled codes */ /* Warn of unhandled codes */
default: default:
if (c != ';') if (c != ';')