From 2f1ccdf6eb69755995262115228c3f764d477a2d Mon Sep 17 00:00:00 2001 From: Keith Winstein Date: Tue, 1 Feb 2011 02:53:39 -0500 Subject: [PATCH] Cursor visibility --- terminal.cpp | 8 ++++++-- terminalframebuffer.cpp | 2 +- terminalframebuffer.hpp | 1 + terminalfunctions.cpp | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/terminal.cpp b/terminal.cpp index f5d6821..f7623ad 100644 --- a/terminal.cpp +++ b/terminal.cpp @@ -180,8 +180,12 @@ void Emulator::debug_printout( int fd ) } char curmove[ 32 ]; - snprintf( curmove, 32, "\033[%d;%dH", fb.ds.get_cursor_row() + 1, - fb.ds.get_cursor_col() + 1 ); + if ( fb.ds.cursor_visible ) { + snprintf( curmove, 32, "\033[?25h\033[%d;%dH", fb.ds.get_cursor_row() + 1, + fb.ds.get_cursor_col() + 1 ); + } else { + snprintf( curmove, 32, "\033[?25l" ); + } screen.append( curmove ); swrite( fd, screen.c_str() ); diff --git a/terminalframebuffer.cpp b/terminalframebuffer.cpp index dfea10d..34cd14a 100644 --- a/terminalframebuffer.cpp +++ b/terminalframebuffer.cpp @@ -47,7 +47,7 @@ DrawState::DrawState( int s_width, int s_height ) scrolling_region_top_row( 0 ), scrolling_region_bottom_row( height - 1 ), renditions(), save(), next_print_will_wrap( false ), origin_mode( false ), auto_wrap_mode( true ), - insert_mode( false ) + insert_mode( false ), cursor_visible( true ) { for ( int i = 0; i < width; i++ ) { tabs[ i ] = ( (i % 8) == 0 ); diff --git a/terminalframebuffer.hpp b/terminalframebuffer.hpp index c456c2b..3800c97 100644 --- a/terminalframebuffer.hpp +++ b/terminalframebuffer.hpp @@ -67,6 +67,7 @@ namespace Terminal { bool origin_mode; bool auto_wrap_mode; bool insert_mode; + bool cursor_visible; /* bold, etc. */ diff --git a/terminalfunctions.cpp b/terminalfunctions.cpp index ebe1384..84d7709 100644 --- a/terminalfunctions.cpp +++ b/terminalfunctions.cpp @@ -220,6 +220,8 @@ static bool *get_DEC_mode( int param, Framebuffer *fb ) { return &(fb->ds.origin_mode); case 7: /* auto wrap */ return &(fb->ds.auto_wrap_mode); + case 25: + return &(fb->ds.cursor_visible); } return NULL; }