Only scroll when DISPLAYING a character.
This commit is contained in:
parent
adb59fe341
commit
57bb593ea8
@ -47,21 +47,6 @@ int ssh_guac_terminal_echo(ssh_guac_terminal* term, char c) {
|
|||||||
int foreground = term->foreground;
|
int foreground = term->foreground;
|
||||||
int background = term->background;
|
int background = term->background;
|
||||||
|
|
||||||
/* Wrap if necessary */
|
|
||||||
if (term->cursor_col >= term->term_width) {
|
|
||||||
term->cursor_col = 0;
|
|
||||||
term->cursor_row++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Scroll up if necessary */
|
|
||||||
if (term->cursor_row >= term->term_height) {
|
|
||||||
term->cursor_row = term->term_height - 1;
|
|
||||||
|
|
||||||
/* Scroll up by one row */
|
|
||||||
ssh_guac_terminal_scroll_up(term, 0, term->term_height - 1, 1);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
|
||||||
/* Bell */
|
/* Bell */
|
||||||
@ -82,6 +67,15 @@ int ssh_guac_terminal_echo(ssh_guac_terminal* term, char c) {
|
|||||||
/* Line feed */
|
/* Line feed */
|
||||||
case '\n':
|
case '\n':
|
||||||
term->cursor_row++;
|
term->cursor_row++;
|
||||||
|
|
||||||
|
/* Scroll up if necessary */
|
||||||
|
if (term->cursor_row >= term->term_height) {
|
||||||
|
term->cursor_row = term->term_height - 1;
|
||||||
|
|
||||||
|
/* Scroll up by one row */
|
||||||
|
ssh_guac_terminal_scroll_up(term, 0, term->term_height - 1, 1);
|
||||||
|
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* ESC */
|
/* ESC */
|
||||||
@ -92,6 +86,21 @@ int ssh_guac_terminal_echo(ssh_guac_terminal* term, char c) {
|
|||||||
/* Displayable chars */
|
/* Displayable chars */
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
/* Wrap if necessary */
|
||||||
|
if (term->cursor_col >= term->term_width) {
|
||||||
|
term->cursor_col = 0;
|
||||||
|
term->cursor_row++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scroll up if necessary */
|
||||||
|
if (term->cursor_row >= term->term_height) {
|
||||||
|
term->cursor_row = term->term_height - 1;
|
||||||
|
|
||||||
|
/* Scroll up by one row */
|
||||||
|
ssh_guac_terminal_scroll_up(term, 0, term->term_height - 1, 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* Handle reverse video */
|
/* Handle reverse video */
|
||||||
if (term->reverse) {
|
if (term->reverse) {
|
||||||
int swap = background;
|
int swap = background;
|
||||||
@ -110,6 +119,7 @@ int ssh_guac_terminal_echo(ssh_guac_terminal* term, char c) {
|
|||||||
|
|
||||||
/* Advance cursor */
|
/* Advance cursor */
|
||||||
term->cursor_col++;
|
term->cursor_col++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user