From 2d5304bba1a66f5e5cd55328916399f1b6b8c2c1 Mon Sep 17 00:00:00 2001 From: Keith Winstein Date: Sun, 13 Feb 2011 00:57:07 -0500 Subject: [PATCH] Support scroll up / scroll down (fixes bug w/nano reported by Anders Kaseorg) --- terminalframebuffer.hpp | 3 +-- terminalfunctions.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/terminalframebuffer.hpp b/terminalframebuffer.hpp index 9e70b0b..14e87d4 100644 --- a/terminalframebuffer.hpp +++ b/terminalframebuffer.hpp @@ -153,14 +153,13 @@ namespace Terminal { std::deque rows; std::vector window_title; - void scroll( int N ); - Row newrow( void ) { return Row( ds.get_width(), ds.get_background_rendition() ); } public: Framebuffer( int s_width, int s_height ); DrawState ds; + void scroll( int N ); void move_rows_autoscroll( int rows ); Row *get_row( int row ) diff --git a/terminalfunctions.cpp b/terminalfunctions.cpp index 35c192e..5d860d2 100644 --- a/terminalfunctions.cpp +++ b/terminalfunctions.cpp @@ -474,3 +474,19 @@ void Dispatcher::OSC_dispatch( Parser::OSC_End *act, Framebuffer *fb ) } } } + +/* scroll down or terminfo indn */ +void CSI_SD( Framebuffer *fb, Dispatcher *dispatch ) +{ + fb->scroll( dispatch->getparam( 0, 1 ) ); +} + +static Function func_CSI_SD( CSI, "S", CSI_SD ); + +/* scroll up or terminfo rin */ +void CSI_SU( Framebuffer *fb, Dispatcher *dispatch ) +{ + fb->scroll( -dispatch->getparam( 0, 1 ) ); +} + +static Function func_CSI_SU( CSI, "T", CSI_SU );