mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-27 20:25:12 +00:00
For for crash when typing backslash c
This commit is contained in:
parent
a0bb2cdc6e
commit
5ae77b4317
2 changed files with 39 additions and 39 deletions
|
@ -242,15 +242,15 @@ static void highlight_param( const wcstring &buffstr, std::vector<int> &colors,
|
||||||
int normal_status = colors.at(0);
|
int normal_status = colors.at(0);
|
||||||
|
|
||||||
for( in_pos=0;
|
for( in_pos=0;
|
||||||
in_pos<len;
|
in_pos<len;
|
||||||
in_pos++ )
|
in_pos++ )
|
||||||
{
|
{
|
||||||
wchar_t c = buffstr.at(in_pos);
|
wchar_t c = buffstr.at(in_pos);
|
||||||
switch( mode )
|
switch( mode )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Mode 0 means unquoted string
|
Mode 0 means unquoted string
|
||||||
*/
|
*/
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if( c == L'\\' )
|
if( c == L'\\' )
|
||||||
|
@ -280,9 +280,10 @@ static void highlight_param( const wcstring &buffstr, std::vector<int> &colors,
|
||||||
colors.at(in_pos+1)=normal_status;
|
colors.at(in_pos+1)=normal_status;
|
||||||
}
|
}
|
||||||
else if( wcschr( L"c", buff[in_pos] ) )
|
else if( wcschr( L"c", buff[in_pos] ) )
|
||||||
{
|
{
|
||||||
colors.at(start_pos)=HIGHLIGHT_ESCAPE;
|
colors.at(start_pos)=HIGHLIGHT_ESCAPE;
|
||||||
colors.at(in_pos+2)=normal_status;
|
if (in_pos+2 < colors.size())
|
||||||
|
colors.at(in_pos+2)=normal_status;
|
||||||
}
|
}
|
||||||
else if( wcschr( L"uUxX01234567", buff[in_pos] ) )
|
else if( wcschr( L"uUxX01234567", buff[in_pos] ) )
|
||||||
{
|
{
|
||||||
|
@ -436,9 +437,9 @@ static void highlight_param( const wcstring &buffstr, std::vector<int> &colors,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Mode 1 means single quoted string, i.e 'foo'
|
Mode 1 means single quoted string, i.e 'foo'
|
||||||
*/
|
*/
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if( c == L'\\' )
|
if( c == L'\\' )
|
||||||
|
@ -471,9 +472,9 @@ static void highlight_param( const wcstring &buffstr, std::vector<int> &colors,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Mode 2 means double quoted string, i.e. "foo"
|
Mode 2 means double quoted string, i.e. "foo"
|
||||||
*/
|
*/
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
switch( c )
|
switch( c )
|
||||||
|
|
|
@ -429,8 +429,7 @@ static wint_t input_try_mapping( const input_mapping_t &m)
|
||||||
input_unreadch( c );
|
input_unreadch( c );
|
||||||
|
|
||||||
const wchar_t *str = m.seq.c_str();
|
const wchar_t *str = m.seq.c_str();
|
||||||
for( j=0; str[j] != L'\0' &&
|
for( j=0; str[j] != L'\0' && str[j] == (c=input_common_readch( j>0 )); j++ )
|
||||||
str[j] == (c=input_common_readch( j>0 )); j++ )
|
|
||||||
;
|
;
|
||||||
|
|
||||||
if( str[j] == L'\0' )
|
if( str[j] == L'\0' )
|
||||||
|
|
Loading…
Reference in a new issue