diff --git a/src/protocols/ssh/guac_handlers.c b/src/protocols/ssh/guac_handlers.c index f575a425..579569e4 100644 --- a/src/protocols/ssh/guac_handlers.c +++ b/src/protocols/ssh/guac_handlers.c @@ -361,6 +361,9 @@ int ssh_guac_client_size_handler(guac_client* client, int width, int height) { /* Resize terminal */ guac_terminal_resize(terminal, columns, rows); + /* Update cursor */ + guac_terminal_commit_cursor(terminal); + /* Update SSH pty size if connected */ if (guac_client_data->term_channel != NULL) libssh2_channel_request_pty_size(guac_client_data->term_channel, diff --git a/src/protocols/ssh/terminal.c b/src/protocols/ssh/terminal.c index 73fc5cac..6692ed91 100644 --- a/src/protocols/ssh/terminal.c +++ b/src/protocols/ssh/terminal.c @@ -753,6 +753,12 @@ void guac_terminal_resize(guac_terminal* term, int width, int height) { } + /* Keep cursor on screen */ + if (term->cursor_row < 0) term->cursor_row = 0; + if (term->cursor_row >= height) term->cursor_row = height-1; + if (term->cursor_col < 0) term->cursor_col = 0; + if (term->cursor_col >= width) term->cursor_col = width-1; + /* Commit new dimensions */ term->term_width = width; term->term_height = height;