mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 10:43:47 +08:00
Fix a bug in completion insertion code on string with escaped quotes. This bug was reported by David Benbennick.
darcs-hash:20060914151821-ac50b-c6628fc01a90865e0aec6e93b39b77c3877606fc.gz
This commit is contained in:
parent
06b5fdc6e8
commit
4399503f4e
32
reader.c
32
reader.c
|
@ -1274,28 +1274,36 @@ static wchar_t get_quote( wchar_t *cmd, int l )
|
|||
int i=0;
|
||||
wchar_t res=0;
|
||||
|
||||
// fwprintf( stderr, L"Woot %ls\n", cmd );
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
if( !cmd[i] )
|
||||
break;
|
||||
|
||||
if( cmd[i] == L'\'' || cmd[i] == L'\"' )
|
||||
if( cmd[i] == L'\\' )
|
||||
{
|
||||
const wchar_t *end = quote_end( &cmd[i] );
|
||||
//fwprintf( stderr, L"Jump %d\n", end-cmd );
|
||||
if(( end == 0 ) || (!*end) || (end-cmd > l))
|
||||
{
|
||||
res = cmd[i];
|
||||
i++;
|
||||
if( !cmd[i] )
|
||||
break;
|
||||
}
|
||||
i = end-cmd+1;
|
||||
i++;
|
||||
}
|
||||
else
|
||||
i++;
|
||||
|
||||
{
|
||||
if( cmd[i] == L'\'' || cmd[i] == L'\"' )
|
||||
{
|
||||
const wchar_t *end = quote_end( &cmd[i] );
|
||||
//fwprintf( stderr, L"Jump %d\n", end-cmd );
|
||||
if(( end == 0 ) || (!*end) || (end-cmd > l))
|
||||
{
|
||||
res = cmd[i];
|
||||
break;
|
||||
}
|
||||
i = end-cmd+1;
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user