Fix interaction of * and + in commands
This commit is contained in:
parent
7a0085290a
commit
38eec45987
1 changed files with 12 additions and 5 deletions
|
@ -72,12 +72,19 @@ namespace
|
||||||
|
|
||||||
std::string fixup_command_polarity(std::string cmd, bool polarity) throw(std::bad_alloc)
|
std::string fixup_command_polarity(std::string cmd, bool polarity) throw(std::bad_alloc)
|
||||||
{
|
{
|
||||||
if(cmd == "")
|
if(cmd == "" || cmd == "*")
|
||||||
return "";
|
return "";
|
||||||
if(cmd[0] != '+' && polarity)
|
if(cmd[0] != '*') {
|
||||||
return "";
|
if(cmd[0] != '+' && polarity)
|
||||||
if(cmd[0] == '+' && !polarity)
|
return "";
|
||||||
cmd[0] = '-';
|
if(cmd[0] == '+' && !polarity)
|
||||||
|
cmd[0] = '-';
|
||||||
|
} else {
|
||||||
|
if(cmd[1] != '+' && polarity)
|
||||||
|
return "";
|
||||||
|
if(cmd[1] == '+' && !polarity)
|
||||||
|
cmd[1] = '-';
|
||||||
|
}
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue