Handle resize when SSH not connected. Update visible cursor row in resize.

This commit is contained in:
Michael Jumper 2013-05-20 10:27:53 -07:00
parent 80825072fe
commit 5fd14b3b4d
3 changed files with 9 additions and 1 deletions

View File

@ -74,6 +74,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
client_data->term = term; client_data->term = term;
client_data->mod_ctrl = 0; client_data->mod_ctrl = 0;
client_data->clipboard_data = NULL; client_data->clipboard_data = NULL;
client_data->term_channel = NULL;
if (argc != 3) { if (argc != 3) {
guac_client_log_error(client, "Wrong number of arguments"); guac_client_log_error(client, "Wrong number of arguments");

View File

@ -333,11 +333,16 @@ int ssh_guac_client_size_handler(guac_client* client, int width, int height) {
/* Resize terminal */ /* Resize terminal */
guac_terminal_resize(terminal, columns, rows); guac_terminal_resize(terminal, columns, rows);
/* FIXME: Make resize call to SSH thread */ /* Update SSH pty size if connected */
if (guac_client_data->term_channel != NULL)
channel_change_pty_size(guac_client_data->term_channel,
terminal->term_width, terminal->term_height);
/* Reset scroll region */ /* Reset scroll region */
terminal->scroll_end = rows - 1; terminal->scroll_end = rows - 1;
guac_terminal_display_flush(terminal->display);
guac_socket_flush(terminal->client->socket);
} }
pthread_mutex_unlock(&(terminal->lock)); pthread_mutex_unlock(&(terminal->lock));

View File

@ -608,6 +608,7 @@ void guac_terminal_resize(guac_terminal* term, int width, int height) {
/* Update buffer top and cursor row based on shift */ /* Update buffer top and cursor row based on shift */
term->buffer->top += shift_amount; term->buffer->top += shift_amount;
term->cursor_row -= shift_amount; term->cursor_row -= shift_amount;
term->visible_cursor_row -= shift_amount;
/* Redraw characters within old region */ /* Redraw characters within old region */
__guac_terminal_redraw_rect(term, height - shift_amount, 0, height-1, width-1); __guac_terminal_redraw_rect(term, height - shift_amount, 0, height-1, width-1);
@ -642,6 +643,7 @@ void guac_terminal_resize(guac_terminal* term, int width, int height) {
/* Update buffer top and cursor row based on shift */ /* Update buffer top and cursor row based on shift */
term->buffer->top -= shift_amount; term->buffer->top -= shift_amount;
term->cursor_row += shift_amount; term->cursor_row += shift_amount;
term->visible_cursor_row += shift_amount;
/* If scrolled enough, use scroll to fulfill entire resize */ /* If scrolled enough, use scroll to fulfill entire resize */
if (term->scroll_offset >= shift_amount) { if (term->scroll_offset >= shift_amount) {