diff options
-rw-r--r-- | reader.c | 10 | ||||
-rw-r--r-- | screen.c | 16 | ||||
-rw-r--r-- | screen.h | 2 |
3 files changed, 19 insertions, 9 deletions
@@ -1418,7 +1418,7 @@ static int handle_completions( array_list_t *comp ) } free( prefix ); - s_reset( &data->screen ); + s_reset( &data->screen, 1 ); repaint(); } @@ -2082,7 +2082,7 @@ void reader_pop() { end_loop = 0; history_set_mode( data->name ); - s_reset( &data->screen ); + s_reset( &data->screen, 1 ); } } @@ -2317,11 +2317,11 @@ wchar_t *reader_readline() data->buff[data->buff_len]='\0'; data->search_mode = NO_SEARCH; - s_reset( &data->screen ); exec_prompt(); reader_super_highlight_me_plenty( data->buff_pos, 0 ); + s_reset( &data->screen, 0 ); repaint(); /* @@ -2454,7 +2454,7 @@ wchar_t *reader_readline() { exec_prompt(); write( 1, "\r", 1 ); - s_reset( &data->screen ); + s_reset( &data->screen, 1 ); repaint(); break; } @@ -2730,7 +2730,7 @@ wchar_t *reader_readline() */ default: { - s_reset( &data->screen ); + s_reset( &data->screen, 1 ); repaint(); break; } @@ -329,7 +329,7 @@ static void s_check_status( screen_t *s) int prev_line = s->actual_cursor[1]; write( 1, "\r", 1 ); - s_reset( s ); + s_reset( s, 0 ); s->actual_cursor[1] = prev_line; } } @@ -653,7 +653,7 @@ static void s_update( screen_t *scr, wchar_t *prompt ) need_clear = 1; s_move( scr, &output, 0, 0 ); scr->actual_width = screen_width; - s_reset( scr ); + s_reset( scr, 1 ); } if( wcscmp( prompt, (wchar_t *)scr->actual_prompt.buff ) ) @@ -867,12 +867,22 @@ void s_write( screen_t *s, s_save_status( s ); } -void s_reset( screen_t *s ) +void s_reset( screen_t *s, int reset_cursor ) { CHECK( s, ); s_reset_arr( &s->actual ); s->actual_cursor[0] = s->actual_cursor[1] = 0; sb_clear( &s->actual_prompt ); s->need_clear=1; + + if( !reset_cursor ) + { + /* + This should prevent reseting the cursor position during the + next repaint. + */ + fstat( 1, &s->prev_buff_1 ); + fstat( 2, &s->prev_buff_2 ); + } } @@ -106,6 +106,6 @@ void s_write( screen_t *s, the contents of the screen. Use this function when some other function than s_write has written to the screen. */ -void s_reset( screen_t *s ); +void s_reset( screen_t *s, int reset_cursor ); #endif |