mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-26 22:27:42 +08:00
Make sure indentation works even if a line begins with whitespace
darcs-hash:20061008232351-ac50b-122ff623a2e428352477aa52afee9a71b40e569e.gz
This commit is contained in:
parent
179f575593
commit
941b472b37
15
parser.c
15
parser.c
@ -3700,19 +3700,28 @@ int parser_test( const wchar_t * buff,
|
||||
|
||||
res = 0;
|
||||
|
||||
|
||||
if( block_level )
|
||||
{
|
||||
int last_level = 0;
|
||||
int i;
|
||||
int i, j;
|
||||
int len = wcslen(buff);
|
||||
for( i=0; i<len; i++ )
|
||||
{
|
||||
if( block_level[i] >= 0 )
|
||||
{
|
||||
last_level = block_level[i];
|
||||
/*
|
||||
Make all whitespace before a token have the new level.
|
||||
*/
|
||||
for( j=i-1; j>=0; j-- )
|
||||
{
|
||||
if( !wcschr( L" \n\t\r", buff[j] ) )
|
||||
break;
|
||||
block_level[j] = last_level;
|
||||
}
|
||||
}
|
||||
block_level[i] = last_level;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if( count!= 0 )
|
||||
|
Loading…
x
Reference in New Issue
Block a user