mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-19 09:53:08 +02:00
ColumnTypeString: Only input of single DOM token should be attempted to be evaluated
Attribute names are often words from natural language (such as start, end or entry). The ColumnTypeString supports resolving DOM references, such that task commands like 'task add proj:3.proj' work. However, the current implementation of the ColumnTypeString::modify only looks at the first token to determine whether the input is a DOM reference or not. This mischaracterizes inputs like 'task add "description:start something"', where the first token of the attribute value looks like a DOM reference (the 'start' attribute), but is in fact, a part of larger string. Since all DOM references are single tokens, only interpret the input as a possible DOM reference if and only if one token was found. Closes #1908.
This commit is contained in:
parent
fac48e5e93
commit
64b6784f69
1 changed files with 6 additions and 1 deletions
|
@ -58,7 +58,12 @@ void ColumnTypeString::modify (Task& task, const std::string& value)
|
|||
std::string domRef;
|
||||
Lexer::Type type;
|
||||
if (lexer.token (domRef, type) &&
|
||||
type == Lexer::Type::dom)
|
||||
type == Lexer::Type::dom &&
|
||||
// Ensure 'value' contains only the DOM reference and no other tokens
|
||||
// The lexer.token returns false for end-of-string.
|
||||
// This works as long as all the DOM references we should support consist
|
||||
// only of a single token.
|
||||
lexer.token (domRef, type) == false)
|
||||
{
|
||||
Eval e;
|
||||
e.addSource (domSource);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue