More CSI, scroll region
This commit is contained in:
parent
9de0e18d11
commit
93d93a64eb
@ -66,6 +66,9 @@ struct ssh_guac_terminal {
|
||||
int term_width;
|
||||
int term_height;
|
||||
|
||||
int scroll_start;
|
||||
int scroll_end;
|
||||
|
||||
int cursor_row;
|
||||
int cursor_col;
|
||||
|
||||
|
@ -111,6 +111,7 @@ int ssh_guac_client_key_handler(guac_client* client, int keysym, int pressed) {
|
||||
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;
|
||||
|
@ -92,15 +92,18 @@ ssh_guac_terminal* ssh_guac_terminal_create(guac_client* client) {
|
||||
term->cursor_row = 0;
|
||||
term->cursor_col = 0;
|
||||
|
||||
term->term_width = 160;
|
||||
term->term_height = 50;
|
||||
term->term_width = 80;
|
||||
term->term_height = 24;
|
||||
term->char_handler = ssh_guac_terminal_echo;
|
||||
|
||||
term->scroll_start = 0;
|
||||
term->scroll_end = term->term_height - 1;
|
||||
|
||||
/* Get font */
|
||||
term->font_desc = pango_font_description_new();
|
||||
pango_font_description_set_family(term->font_desc, "monospace");
|
||||
pango_font_description_set_weight(term->font_desc, PANGO_WEIGHT_NORMAL);
|
||||
pango_font_description_set_size(term->font_desc, 8*PANGO_SCALE);
|
||||
pango_font_description_set_size(term->font_desc, 14*PANGO_SCALE);
|
||||
|
||||
font_map = pango_cairo_font_map_get_default();
|
||||
context = pango_font_map_create_context(font_map);
|
||||
|
@ -69,11 +69,11 @@ int ssh_guac_terminal_echo(ssh_guac_terminal* term, char c) {
|
||||
term->cursor_row++;
|
||||
|
||||
/* Scroll up if necessary */
|
||||
if (term->cursor_row >= term->term_height) {
|
||||
term->cursor_row = term->term_height - 1;
|
||||
if (term->cursor_row > term->scroll_end) {
|
||||
term->cursor_row = term->scroll_end;
|
||||
|
||||
/* Scroll up by one row */
|
||||
ssh_guac_terminal_scroll_up(term, 0, term->term_height - 1, 1);
|
||||
ssh_guac_terminal_scroll_up(term, term->scroll_start, term->scroll_end, 1);
|
||||
|
||||
}
|
||||
break;
|
||||
@ -93,11 +93,11 @@ int ssh_guac_terminal_echo(ssh_guac_terminal* term, char c) {
|
||||
}
|
||||
|
||||
/* Scroll up if necessary */
|
||||
if (term->cursor_row >= term->term_height) {
|
||||
term->cursor_row = term->term_height - 1;
|
||||
if (term->cursor_row > term->scroll_end) {
|
||||
term->cursor_row = term->scroll_end;
|
||||
|
||||
/* Scroll up by one row */
|
||||
ssh_guac_terminal_scroll_up(term, 0, term->term_height - 1, 1);
|
||||
ssh_guac_terminal_scroll_up(term, term->scroll_start, term->scroll_end, 1);
|
||||
|
||||
}
|
||||
|
||||
@ -326,6 +326,12 @@ int ssh_guac_terminal_csi(ssh_guac_terminal* term, char c) {
|
||||
|
||||
break;
|
||||
|
||||
/* r: Set scrolling region */
|
||||
case 'r':
|
||||
term->scroll_start = argv[0]-1;
|
||||
term->scroll_end = argv[1]-1;
|
||||
break;
|
||||
|
||||
/* H: Move cursor */
|
||||
case 'H':
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user