From b10a94df836c672761028dac72998c82b0e3105f Mon Sep 17 00:00:00 2001 From: Keith Winstein Date: Thu, 2 Feb 2012 02:54:55 -0500 Subject: [PATCH] Speed up cursor validity decision --- terminaloverlay.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/terminaloverlay.cpp b/terminaloverlay.cpp index 05dc273..974f0a6 100644 --- a/terminaloverlay.cpp +++ b/terminaloverlay.cpp @@ -31,6 +31,7 @@ void ConditionalOverlayCell::apply( Framebuffer &fb, uint64_t confirmed_epoch, i if ( unknown ) { // fb.get_mutable_cell( row, col )->contents.clear(); + fb.get_mutable_cell( row, col )->renditions.underlined = true; return; } @@ -114,22 +115,22 @@ Validity ConditionalCursorMove::get_validity( const Framebuffer &fb, uint64_t cu return Pending; } + if ( (fb.ds.get_cursor_col() == col) + && (fb.ds.get_cursor_row() == row) ) { + return Correct; + } + assert( expiration_time != uint64_t(-1) ); if ( now < expiration_time ) { return Pending; } - if ( (fb.ds.get_cursor_col() == col) - && (fb.ds.get_cursor_row() == row) ) { - return Correct; - } else { - /* + /* fprintf( stderr, "Bad cursor in %d (I thought (%d,%d) vs actual (%d,%d)).\n", (int)current_frame, - row, col, fb.ds.get_cursor_row(), fb.ds.get_cursor_col() ); - */ - return IncorrectOrExpired; - } + row, col, fb.ds.get_cursor_row(), fb.ds.get_cursor_col() ); + */ + return IncorrectOrExpired; } void ConditionalCursorMove::apply( Framebuffer &fb, uint64_t confirmed_epoch ) const