From c62bba9e15d19f082e956434847b8fa2a2c32b90 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 21 May 2013 22:37:53 -0700 Subject: [PATCH] Fix scroll region set CSI (no parameters should reset region) --- protocols/ssh/src/terminal_handlers.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/protocols/ssh/src/terminal_handlers.c b/protocols/ssh/src/terminal_handlers.c index a2f91cb2..0aa9a6a8 100644 --- a/protocols/ssh/src/terminal_handlers.c +++ b/protocols/ssh/src/terminal_handlers.c @@ -37,6 +37,7 @@ #include +#include "common.h" #include "terminal.h" #include "terminal_handlers.h" @@ -500,6 +501,10 @@ int guac_terminal_csi(guac_terminal* term, char c) { break; + /* c: Identify */ + case 'c': + guac_terminal_write_all(term->stdin_pipe_fd[1], "\x1B[?6c", 5); + break; /* d: Move cursor, current col */ case 'd': @@ -575,8 +580,19 @@ int guac_terminal_csi(guac_terminal* term, char c) { /* r: Set scrolling region */ case 'r': - term->scroll_start = argv[0]-1; - term->scroll_end = argv[1]-1; + + /* If parameters given, set region */ + if (argc == 2) { + term->scroll_start = argv[0]-1; + term->scroll_end = argv[1]-1; + } + + /* Otherwise, reset scrolling region */ + else { + term->scroll_start = 0; + term->scroll_end = term->term_height - 1; + } + break; /* Warn of unhandled codes */