diff --git a/doc_src/doc.hdr b/doc_src/doc.hdr index 98f5c40cb..4e88dc4db 100644 --- a/doc_src/doc.hdr +++ b/doc_src/doc.hdr @@ -1312,6 +1312,8 @@ g++, javac, java, gcj, lpr, doxygen, whois, find) - Reduce the space of the pager by one line to allow the commandline to remain visible. - down-arrow could be used to save the current command to the history. Or give the next command in-sequnce. Or both. - A pretty-printer. +- Help messages for builtin should not be compiled into fish, they should be kept in a separate directory +- Shellscript functions should be able to show help on the commandline instead of launching a browser \subsection bugs Known bugs diff --git a/parser.c b/parser.c index 42cc043b8..635c6bc0a 100644 --- a/parser.c +++ b/parser.c @@ -3006,7 +3006,7 @@ int parser_test( const wchar_t * buff, int previous_pos=current_tokenizer_pos; static int block_pos[BLOCK_MAX_COUNT]; static int block_type[BLOCK_MAX_COUNT]; - int res; + int res = 0; /* Set to 1 if the current command is inside a pipeline @@ -3696,16 +3696,11 @@ int parser_test( const wchar_t * buff, } - tok_destroy( &tok ); - - current_tokenizer=previous_tokenizer; - current_tokenizer_pos = previous_pos; - - error_code=0; - - halloc_free( context ); - - res = 0; + /* + Fill in the unset block_level entries. Until now, only places + where the block level _changed_ have been filled out. This fills + in the rest. + */ if( block_level ) { @@ -3718,7 +3713,9 @@ int parser_test( const wchar_t * buff, { last_level = block_level[i]; /* - Make all whitespace before a token have the new level. + Make all whitespace before a token have the new + level. This avoid using the wrong indentation level + if a new line starts with whitespace. */ for( j=i-1; j>=0; j-- ) { @@ -3729,6 +3726,12 @@ int parser_test( const wchar_t * buff, } block_level[i] = last_level; } + + /* + Make all trailing whitespace have the block level that the + validator had at exit. This makes sure a new line is + correctly indented even if it is empty. + */ for( j=len-1; j>=0; j-- ) { if( !wcschr( L" \n\t\r", buff[j] ) ) @@ -3739,6 +3742,9 @@ int parser_test( const wchar_t * buff, } + /* + Calculate exit status + */ if( count!= 0 ) unfinished = 1; @@ -3747,7 +3753,21 @@ int parser_test( const wchar_t * buff, if( unfinished ) res |= PARSER_TEST_INCOMPLETE; + + /* + Cleanup + */ + halloc_free( context ); + + tok_destroy( &tok ); + + current_tokenizer=previous_tokenizer; + current_tokenizer_pos = previous_pos; + + error_code=0; + + return res; } diff --git a/screen.c b/screen.c index 9e229499c..480c76ec7 100644 --- a/screen.c +++ b/screen.c @@ -728,24 +728,19 @@ void s_write( screen_t *s, for( i=0; b[i]; i++ ) { int col = c[i]; - int ind = indent[i]; if( i == cursor ) { col = 0; } - if( b[i] == L'\n' && b[i+1] ) - ind = indent[i+1]; - - if( i == cursor ) { cursor_arr[0] = s->desired_cursor[0]; cursor_arr[1] = s->desired_cursor[1]; } - s_desired_append_char( s, b[i], col, ind, prompt_width ); + s_desired_append_char( s, b[i], col, indent[i], prompt_width ); if( i== cursor && s->desired_cursor[1] != cursor_arr[1] && b[i] != L'\n' ) {