Open taskwarrior opened 6 years ago
Migrated metadata:
Created: 2014-01-25T21:46:37Z
Modified: 2017-10-11T14:36:37Z
Paul Beckingham on 2014-07-06T04:50:05Z says:
Needs a more extensive change to ViewTask than expected.
Peter Vitt on 2017-10-11T14:36:37Z says:
As I also requested that feature several years before, I finally plucked up courage and dove into this a little.
A pseudo call tree for this looks like:
I want to print something (in this example an info report), therefore I take a Table: {code:java} Table view; view.width (context.getWidth ()); view.add (STRING_COLUMN_LABEL_NAME); view.add (STRING_COLUMN_LABEL_VALUE); setHeaderUnderline (view);
// id auto row = view.addRow (); view.set (row, 0, STRING_COLUMN_LABEL_ID); view.set (row, 1, (task.id ? format (task.id) : "-"));
// description auto description = task.get ("description"); auto indent = context.config.getInteger ("indent.annotation");
for (auto& anno : task.getAnnotations ()) description += '\n'
row = view.addRow (); view.set (row, 0, STRING_COLUMN_LABEL_DESC); view.set (row, 1, description, c); {code} Here the task's description is added to the variable description, and after that all annotations are added with their date, whereas those annotations are indented (configured via indent.annotation) and separated by a newline character. This string is passed to [Table::set|https://git.tasktools.org/TM/libshared/src/master/src/Table.cpp#L79]
When the table is rendered, the entries from _data
are passed to [renderCell|https://git.tasktools.org/TM/libshared/src/master/src/Table.cpp#L337], where it is passed to [wrapText|https://git.tasktools.org/TM/libshared/src/master/src/shared.cpp#L46] where it is again passed to [extractLine|https://git.tasktools.org/TM/libshared/src/master/src/shared.cpp#L265].
In subsequent calls to extractLine, the original string is looked at character by character and converted into line after line. Thus, this is the place where the indentation has to take place. However, this routine is a generic routine, thus it doesn't know about annotations at all, it just cares about strings.
From my point of view, there are (at least) two possible ways to also indent multi-line annotations:
extractLine
aware of what it is currently dissecting.extractLine
sensible for line indentations.The first approach would result in a lot of changes to the code, as the information of what extractLine
is working on has to be passed around, and it would reduce the genericity (is this actually a word?) of that routine.
The second approach is the more appealing on, I think. extractLine
could be enabled to recognize the indentation width by counting white space at the beginning of the line . And if this line has to be wrapped, this indentation width could be used (e.g. doubled) to indent the next line as well.
I [added a very rough idea|https://bug.tasktools.org/secure/attachment/11606/indent.diff] of what this could look like.
Any update on this? Started using TW recently and the broken indentation is extremely triggering.
Hi @N-R-K, the issue currently sits in the backlog milestone, so it's not considered for the next release (2.6.0). That said, we could re-prioritize. Perhaps you'd be willing to help out with this?
Perhaps you'd be willing to help out with this?
Would love to if I could. Unfortunately I don't know much beyond shell scripts. Would appreciate if the priority on this gets bumped.
On a side note, the 1 hour long yt video you had on task warrior was very helpful in getting started and setting things up. So thanks for that.
Elias Probst on 2014-01-25T21:46:37Z says:
The value defined by rc.indent.annotation is only applied to the 1st line of the annotation. Using task 2.3.0.