From 6265f192ad56df6f6d1bae58e7727d7f780e2582 Mon Sep 17 00:00:00 2001 From: Keith Winstein Date: Tue, 1 Feb 2011 02:48:08 -0500 Subject: [PATCH] Soft reset --- terminalframebuffer.cpp | 9 +++++++++ terminalframebuffer.hpp | 2 ++ terminalfunctions.cpp | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/terminalframebuffer.cpp b/terminalframebuffer.cpp index 6884817..dfea10d 100644 --- a/terminalframebuffer.cpp +++ b/terminalframebuffer.cpp @@ -313,3 +313,12 @@ void Framebuffer::reset( void ) rows = std::deque( height, Row( width ) ); ds = DrawState( width, height ); } + +void Framebuffer::soft_reset( void ) +{ + ds.insert_mode = false; + ds.origin_mode = false; + ds.set_scrolling_region( 0, ds.get_height() - 1 ); + ds.clear_renditions(); + ds.clear_saved_cursor(); +} diff --git a/terminalframebuffer.hpp b/terminalframebuffer.hpp index 43069c7..c456c2b 100644 --- a/terminalframebuffer.hpp +++ b/terminalframebuffer.hpp @@ -100,6 +100,7 @@ namespace Terminal { void save_cursor( void ); void restore_cursor( void ); + void clear_saved_cursor( void ) { save = SavedCursor(); } DrawState( int s_width, int s_height ); }; @@ -129,6 +130,7 @@ namespace Terminal { void delete_cell( int row, int col ); void reset( void ); + void soft_reset( void ); }; } diff --git a/terminalfunctions.cpp b/terminalfunctions.cpp index d22eae9..ebe1384 100644 --- a/terminalfunctions.cpp +++ b/terminalfunctions.cpp @@ -447,3 +447,11 @@ void Esc_RIS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) } static Function func_Esc_RIS( ESCAPE, "c", Esc_RIS ); + +/* soft reset */ +void CSI_DECSTR( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) +{ + fb->soft_reset(); +} + +static Function func_CSI_DECSTR( CSI, "!p", CSI_DECSTR );