Improving reports in narrow terminals with a more responsive design #4035
ryneeverett
started this conversation in
Ideas
Replies: 1 comment 2 replies
|
Would it be worth looking at some of the approaches used in layout of web pages? Could we do something along the lines of CSS, including a |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I've been kicking around some ideas for how to improve both the default behavior and the configurability of taskwarrior's reports on narrow terminals.
For reference, this seems to be the most relevant code in ViewTask.cpp:
Details
Proposals
report.<report>.prioritiesThis would address the pain of having to configure either different custom reports or different taskrc's to take advantage of different terminal widths. A new setting could be added that lets the user tune the order in which columns get dropped in narrower terminals. For example:
report.next.priorities = description,id,urgency,entry.age,depends,priority,project,tags,due.relative,<bonus>,scheduled.countdown,until.remaining,recur,start.ageI would imagine the logic being altered as follows:
<bonus>sentinel value first, we stop and go on to the longest column shortening logic we currently have.Minimize Wasted (Blank) Space
On smaller terminals, the thing I find dissatisfying which cannot be satisfactorily addressed with configuration is the amount of whitespace shown. Sometimes the description will be truncated more than necessary because one anomalously long project or tag name is hogging the width. Assuming it were computationally practical, I think an ideal behavior would be to truncate on the basis of which columns actually make use of their width.
From an implementation standpoint, while we're iterating through all the values to build the
minimumandidealvectors, we could also build astd::vector<std::vector<std::int>> lengthswhere the outer vector has an vector for each column and the inner vector an integer length for each row. We could then sort the inner vectors by size in ascending order and then truncate the columns one character at a time until the overage is eliminated. Pseudocode:Alternatively, maybe we could calculate this optimum with calculus or use a statistical approach to estimate a vector of
practical_widthfor each column (maybe set to the 80th percentile of content-length in the column) to shorten to before shortening the longest column, but I'm doubtful these approaches would result in leaner or more performant code than the "dumb" approach (which also might be too expensive).All reactions