aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar liljencrantz <liljencrantz@gmail.com>2007-09-24 18:13:01 +1000
committerGravatar liljencrantz <liljencrantz@gmail.com>2007-09-24 18:13:01 +1000
commit0b7b20f0135f7a5aa4929f8dad7112f48e5f2d16 (patch)
treea3db4bb11c92c80944f8c31b55beb85b4a64c34d
parent819c20e1d811dcd1cc4109325c63f61c58d9e3fb (diff)
Make sure that ouput with no trailing newline is not eaten. This is a regression bug fix.
darcs-hash:20070924081301-75c98-86bd87a9323044807e78b8eb904bd6c5830ee23f.gz
-rw-r--r--reader.c10
-rw-r--r--screen.c16
-rw-r--r--screen.h2
3 files changed, 19 insertions, 9 deletions
diff --git a/reader.c b/reader.c
index f138334f..3dd86b69 100644
--- a/reader.c
+++ b/reader.c
@@ -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;
}
diff --git a/screen.c b/screen.c
index 9cd6be6d..f667188a 100644
--- a/screen.c
+++ b/screen.c
@@ -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 );
+ }
}
diff --git a/screen.h b/screen.h
index a50eacb0..581fce39 100644
--- a/screen.h
+++ b/screen.h
@@ -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