Minor cleanups and improved error checking in reader code

darcs-hash:20061025203608-ac50b-213edeb462eaabce849d9cd13ffc30879e810bb8.gz
This commit is contained in:
axel 2006-10-26 06:36:08 +10:00
parent c627509e59
commit e0899addcb
2 changed files with 15 additions and 11 deletions

View file

@ -361,6 +361,9 @@ int reader_exit_forced()
return exit_forced;
}
/**
Internal helper function for handling killing parts of text.
*/
static void reader_kill( wchar_t *begin, int length, int mode, int new )
{
if( new )
@ -1286,6 +1289,8 @@ void reader_replace_current_token( wchar_t *new_token )
*/
static void handle_history( const wchar_t *new_str )
{
if( new_str )
{
data->buff_len = wcslen( new_str );
check_size();
wcscpy( data->buff, new_str );
@ -1293,6 +1298,7 @@ static void handle_history( const wchar_t *new_str )
reader_super_highlight_me_plenty( data->buff_pos, 0 );
repaint();
}
}
/**
@ -1840,7 +1846,6 @@ static void reader_super_highlight_me_plenty( int match_highlight_pos, array_lis
int start = match-data->buff;
int count = wcslen(data->search_buff );
int i;
// fwprintf( stderr, L"WEE color from %d to %d\n", start, start+count );
for( i=0; i<count; i++ )
{
@ -1871,7 +1876,6 @@ static int read_i()
reader_set_highlight_function( &highlight_shell );
reader_set_test_function( &shell_test );
// data->prompt_width=60;
data->prev_end_loop=0;
while( (!data->end_loop) && (!sanity_check()) )
@ -1980,7 +1984,8 @@ wchar_t *reader_readline()
reader_super_highlight_me_plenty( data->buff_pos, 0 );
repaint();
tcgetattr(0,&old_modes); /* get the current terminal modes */
/* get the current terminal modes. These will be restored when the function returns. */
tcgetattr(0,&old_modes);
if( tcsetattr(0,TCSANOW,&shell_modes)) /* set the new modes */
{
wperror(L"tcsetattr");

View file

@ -167,5 +167,4 @@ void reader_handle_int( int signal );
*/
int reader_exit_forced();
#endif