mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 13:48:00 +01:00
made quoting a little more bash/vim-like
This commit is contained in:
@@ -151,6 +151,7 @@ function Commands() //{{{
|
|||||||
|
|
||||||
// in '-quoted strings, only ' and \ itself are escaped
|
// in '-quoted strings, only ' and \ itself are escaped
|
||||||
// in "-quoted strings, also ", \n and \t are translated
|
// in "-quoted strings, also ", \n and \t are translated
|
||||||
|
// in non-quoted strings everything is taken literally apart from "\ " and "\\"
|
||||||
//
|
//
|
||||||
// "options" is an array [name, type, validator, completions] and could look like:
|
// "options" is an array [name, type, validator, completions] and could look like:
|
||||||
// options = [[["-force"], OPTION_NOARG],
|
// options = [[["-force"], OPTION_NOARG],
|
||||||
@@ -214,11 +215,17 @@ function Commands() //{{{
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
in_escape_key = true;
|
// only escape "\\" and "\ " in non quoted strings
|
||||||
if (in_single_string && str[i+1] != "\\" && str[i+1] != "'")
|
if (!in_single_string && !in_double_string && str[i+1] != "\\" && str[i+1] != " ")
|
||||||
|
continue outer;
|
||||||
|
// only escape "\\" and "\'" in single quoted strings
|
||||||
|
else if (in_single_string && str[i+1] != "\\" && str[i+1] != "'")
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
in_escape_key = true;
|
||||||
continue outer;
|
continue outer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -660,7 +667,7 @@ function Commands() //{{{
|
|||||||
vimperator.echoerr(res.error);
|
vimperator.echoerr(res.error);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vimperator.echo(vimperator.util.colorize(res));
|
vimperator.echo(vimperator.util.colorize(res.args));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user