mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
TW-1670: Reversed ranges are parsed as a mathematician would expect
- Thanks to Daniel Shahaf.
This commit is contained in:
parent
eabd47b28b
commit
3f4daeacf0
2 changed files with 12 additions and 2 deletions
12
src/CLI2.cpp
12
src/CLI2.cpp
|
@ -1619,11 +1619,19 @@ void CLI2::insertIDExpr ()
|
|||
}
|
||||
else
|
||||
{
|
||||
bool ascending = true;
|
||||
int low = strtol (r->first.c_str (), NULL, 10);
|
||||
int high = strtol (r->second.c_str (), NULL, 10);
|
||||
if (low <= high)
|
||||
ascending = true;
|
||||
else
|
||||
ascending = false;
|
||||
|
||||
reconstructed.push_back (openParen);
|
||||
reconstructed.push_back (argID);
|
||||
reconstructed.push_back (opGTE);
|
||||
|
||||
A2 startValue (r->first, Lexer::Type::number);
|
||||
A2 startValue ((ascending ? r->first : r->second), Lexer::Type::number);
|
||||
startValue.tag ("FILTER");
|
||||
reconstructed.push_back (startValue);
|
||||
|
||||
|
@ -1631,7 +1639,7 @@ void CLI2::insertIDExpr ()
|
|||
reconstructed.push_back (argID);
|
||||
reconstructed.push_back (opLTE);
|
||||
|
||||
A2 endValue (r->second, Lexer::Type::number);
|
||||
A2 endValue ((ascending ? r->second : r->first), Lexer::Type::number);
|
||||
endValue.tag ("FILTER");
|
||||
reconstructed.push_back (endValue);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue