mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-26 05:45:22 +08:00
Minor cleanups and improved error checking in reader code
darcs-hash:20061025203608-ac50b-213edeb462eaabce849d9cd13ffc30879e810bb8.gz
This commit is contained in:
parent
c627509e59
commit
e0899addcb
11
reader.c
11
reader.c
@ -361,6 +361,9 @@ int reader_exit_forced()
|
|||||||
return 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 )
|
static void reader_kill( wchar_t *begin, int length, int mode, int new )
|
||||||
{
|
{
|
||||||
if( new )
|
if( new )
|
||||||
@ -1285,6 +1288,8 @@ void reader_replace_current_token( wchar_t *new_token )
|
|||||||
not modify prefix_width.
|
not modify prefix_width.
|
||||||
*/
|
*/
|
||||||
static void handle_history( const wchar_t *new_str )
|
static void handle_history( const wchar_t *new_str )
|
||||||
|
{
|
||||||
|
if( new_str )
|
||||||
{
|
{
|
||||||
data->buff_len = wcslen( new_str );
|
data->buff_len = wcslen( new_str );
|
||||||
check_size();
|
check_size();
|
||||||
@ -1294,6 +1299,7 @@ static void handle_history( const wchar_t *new_str )
|
|||||||
|
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check if the specified string is contained in the list, using
|
Check if the specified string is contained in the list, using
|
||||||
@ -1840,7 +1846,6 @@ static void reader_super_highlight_me_plenty( int match_highlight_pos, array_lis
|
|||||||
int start = match-data->buff;
|
int start = match-data->buff;
|
||||||
int count = wcslen(data->search_buff );
|
int count = wcslen(data->search_buff );
|
||||||
int i;
|
int i;
|
||||||
// fwprintf( stderr, L"WEE color from %d to %d\n", start, start+count );
|
|
||||||
|
|
||||||
for( i=0; i<count; i++ )
|
for( i=0; i<count; i++ )
|
||||||
{
|
{
|
||||||
@ -1871,7 +1876,6 @@ static int read_i()
|
|||||||
reader_set_highlight_function( &highlight_shell );
|
reader_set_highlight_function( &highlight_shell );
|
||||||
reader_set_test_function( &shell_test );
|
reader_set_test_function( &shell_test );
|
||||||
|
|
||||||
// data->prompt_width=60;
|
|
||||||
data->prev_end_loop=0;
|
data->prev_end_loop=0;
|
||||||
|
|
||||||
while( (!data->end_loop) && (!sanity_check()) )
|
while( (!data->end_loop) && (!sanity_check()) )
|
||||||
@ -1980,7 +1984,8 @@ wchar_t *reader_readline()
|
|||||||
reader_super_highlight_me_plenty( data->buff_pos, 0 );
|
reader_super_highlight_me_plenty( data->buff_pos, 0 );
|
||||||
repaint();
|
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 */
|
if( tcsetattr(0,TCSANOW,&shell_modes)) /* set the new modes */
|
||||||
{
|
{
|
||||||
wperror(L"tcsetattr");
|
wperror(L"tcsetattr");
|
||||||
|
1
reader.h
1
reader.h
@ -167,5 +167,4 @@ void reader_handle_int( int signal );
|
|||||||
*/
|
*/
|
||||||
int reader_exit_forced();
|
int reader_exit_forced();
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user