Commit graph

6156 commits

Author SHA1 Message Date
Rosen Penev
73575f8d88 convert manual loops to std::count_if
Simpler and generates less assembly.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-01 21:20:52 -04:00
Tomas Babej
62399239ca Filter: Make +ACTIVE trigger pendingOnly shortcut 2021-04-24 15:28:00 -04:00
Tomas Babej
523e2b40fe Filter: Consider presence of +PENDING tag signal to skip completed.data
This puts +PENDING at the same level of treatment as status:pending when
it comes to decision whether the data processed should be pending only.

The mechanism is by no means perfect and should be improved in the
future.
2021-04-24 15:28:00 -04:00
Tomas Babej
5e87be4641 Filter: Fix copy-paste error in pendingOnly 2021-04-24 15:28:00 -04:00
Tomas Babej
c7fd6b798b libshared: Bump version to support Pig.getUntilAscii 2021-04-24 10:47:28 -04:00
Tomas Babej
87d0499fc8 performance: Use ascii-only version of getUnitl for parsing attribute names
Not having to consider utf-8 characters has performance benefits.
2021-04-24 10:47:28 -04:00
Tomas Babej
95b135b59e DOM: Create a copy of Task object only if needed 2021-04-24 10:47:28 -04:00
Tomas Babej
87b0be9b6f performance: Pre-emptively reserve size of the values vector
Each token will add a corresponding Variant into the vector, so we can
avoid the performance penalty connected with dynamic resizes of the
vector.
2021-04-24 10:47:28 -04:00
Tomas Babej
312f77f703 performance: Do not use Pig to extract raw line content 2021-04-24 10:47:28 -04:00
Tomas Babej
e7487c8a63 performance: Avoid lexing input when not needed in getDOM
Lexing a token can be expensive operation. Perform lexing only if a
UUID/ID reference could have been provided.
2021-04-24 10:47:28 -04:00
Tomas Babej
c3f9d09d22 performance: Cache used command value
The detected command does not change once CLI2::analysis has been
performed. Cache the value of the command to avoid the need to
re-discover the correct value each time we're interested in it.
2021-04-24 10:47:28 -04:00
Tomas Babej
a19773873a performance: Cache CLI2::canonicalize lookups
Canonicalization of attributes or attribute prefixes happens once per
every single task considered in the filtering process. It maps short,
prefixed names to their full-length versions, for example:

"pro" -> "project" in the expression "project:Home"

It follows that such process is not task-dependant and as such the
lookups can be cached.
2021-04-24 10:47:28 -04:00
Rosen Penev
ab7f5b0b51 clang-tidy: loop conversion
Found with modernize-loop-convert

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-04-23 09:13:22 -04:00
Rosen Penev
15f0ab87e0 clang-tidy: use const references
Found with performance-for-range-copy

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-04-23 01:59:45 -04:00
Rosen Penev
e84930be8d clang-tidy: use auto
Found with modernize-use-auto

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-04-23 01:39:23 -04:00
Rosen Penev
d0c4350c2f clang-tidy: add missing reserve calls
Found with performance-inefficient-vector-operation

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-04-23 00:22:43 -04:00
Rosen Penev
3cafb5257e clang-tidy: use = default
Found with modernize-use-equals-default

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-04-23 00:15:06 -04:00
Rosen Penev
4aaaa8dcc8 clang-tidy: use bool literals
Found with modernize-use-bool-literals

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-04-23 00:11:52 -04:00
Rosen Penev
8ffb85b327 clang-tidy: use '' for single character find
Found with performance-faster-string-find

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-04-22 23:18:16 -04:00
Tomas Babej
44220287c4 CmdCalendar: Only display relevant parts of the legend 2021-04-21 23:44:36 -04:00
Tomas Babej
282f3d344a
CmdCalendar: Adjust styling 2021-04-21 23:09:08 -04:00
DanielMowitz
a16f3addc7 Made CmdCalendar.cpp even less redundant by only calling
config.get ("dateformat.holiday") once for every method.
2021-04-21 22:23:00 -04:00
DanielMowitz
23244e61a5 Renamed variables to be more consistent and improved readability. 2021-04-21 22:23:00 -04:00
DanielMowitz
f703bd5a74 Made CmdCalendar.cpp less redundant by only calling
Context::getContext().config once per method.
2021-04-21 22:23:00 -04:00
DanielMowitz
45c67fef6e Update CmdCalendar.cpp
Converted some tabs to spaces and added braces to a for loop.
2021-04-21 22:23:00 -04:00
DanielMowitz
374b97bb66 Implemented multi-day holidays. 2021-04-21 22:23:00 -04:00
DanielMowitz
dc5ebfa612 Made the code for colorizing the calendar a little more dry. 2021-04-21 22:23:00 -04:00
Tomas Babej
bd0d907335 CLI2: Apply desugaring of plain filter args to date args
This ensures that commands like `task marc` perform description
substring search on `marc`.

Closes #2451.
2021-04-14 02:44:33 -04:00
Tomas Babej
475a16b3d4 CLI2: Fix docstring for desugarFilterPlainArgs
Desugaring is applied also for tokens of Lexer::type::identifier, make
sure the docstring correctly documents that.
2021-04-14 02:44:33 -04:00
Paolo Capriotti
856b589bac Parse 'context' verbose token correctly 2021-04-11 20:32:42 -04:00
Max Rossmannek
6546c050c5 Un-wait a waiting task when deleted 2021-04-06 23:34:32 -04:00
Max Rossmannek
33dcea68f5 Un-wait a waiting task when done
Implements #2322
2021-04-06 23:34:32 -04:00
DanielMowitz
fb6c42f375 Change nagging behavior
Don't nag if the specified set of tasks consists only of highest urgency tasks.
2021-04-04 22:06:07 -04:00
Tomas Babej
693f2f74cd CmdEdit: Respect bulk option
Since 'task edit' is a data-modification operation (that is particularly
hard to cancel mid-way), it should also respect the 'bulk' option like
all the other modification operations (mod, start...).

Closes #2428.
2021-04-03 17:57:08 -04:00
Tomas Babej
fe6a6ca93b compatibility: Explicitly specify template type to support older compilers
This makes curret development branch buildable on Ubuntu 18 / Centos 7 /
SUSE 15.
2021-04-03 15:01:39 -04:00
Tomas Babej
c701137313 CmdContext: Report context as not found if nothing was deleted 2021-04-03 15:01:39 -04:00
Tomas Babej
1bba59e972 CLI2: Move the recursion block to the right place in addContext 2021-04-03 15:01:39 -04:00
Tomas Babej
201b1c37b4 CmdContext: Allow user to define read-only / write-only contexts 2021-04-03 15:01:39 -04:00
Tomas Babej
4de23a3e20 CmdContext: Remove all types of context when deleting 2021-04-03 15:01:39 -04:00
Tomas Babej
062878022b CmdContext: Expand information provided in 'context show' 2021-04-03 15:01:39 -04:00
Tomas Babej
a558ffcd42 CmdContext: List info about both read and write context 2021-04-03 15:01:39 -04:00
Tomas Babej
351c3b025c getTaskContext: Allow getting context info for a non-active context 2021-04-03 15:01:39 -04:00
Tomas Babej
c0ded37f91 CmdContext: Discard .read/.write suffix when discovering contexts 2021-04-03 15:01:39 -04:00
Tomas Babej
41823c7939 CmdContext: Expand description 2021-04-03 15:01:39 -04:00
Tomas Babej
9a380887ee CLI2: Simplify context determination
Simlifies by offloading portion of the logic into the singleton Context
class (which has nothing to do with the task context per se, just a
implementation singleton).
2021-04-03 15:01:39 -04:00
Tomas Babej
985aab0541 CmdContext: Define both read and write context 2021-04-03 15:01:39 -04:00
Tomas Babej
5716f5abb7 CLI2: Generalize method to add context to support writeable context 2021-04-03 15:01:39 -04:00
Tomas Babej
5c3cf0f438 CLI2: Implement inserting modification arguments
Method to inject mods into the command, to be used by writeable context.
2021-04-03 15:01:39 -04:00
Tomas Babej
9128798fee CLI2: Generalize 'add' to insert arguments at arbitrary position 2021-04-03 15:01:39 -04:00
Tomas Babej
9bc726ba61 commands: Modify CmdAdd and CmdLog to use context
This only sets the command properties.
2021-04-03 15:01:39 -04:00