Fix width argument, set overall width#825
Conversation
Fix the width for the description details, both default and as cmdline option, and make sure we don't break the width of the calw and calm output. The (pretty much undocumented) option --width/-w option was used for setting the width of a day table cell in calw and calm but seemed to also be intended for setting the overall width of the description in agenda. The latter part was broken and the details description width would always default to 80. We change the behaviour to set the overall width of the table, defaulting to the terminal width, both for calw and calm and for description details. The width of the day cell is calculated from the overall width.
|
|
||
|
|
||
| def validwidth(value): | ||
| minwidth=30 |
There was a problem hiding this comment.
This change from 10 to 30 is because 10 was just intended as the min size for one day cell vs whole output? Is there a specific reason for picking 30?
There was a problem hiding this comment.
It's kind of the minimal width that still makes any sense for gcalcli agenda --details description. For 30 it comes out to about a width of 5 chars for the description. But I'm happy to change it to anything else obviously.
Mon Jan 27 8:30 Strategy meeting
Description:
┌───────┐
│ aaaaa │
│ aaaaa │
│ aaaaa │
│ aaaaa │
There was a problem hiding this comment.
Nah I doubt it'll bother anyone, just wanted to understand if it's an intentional behavior change.
|
Would you mind giving an example of output before/after for reference? And I see some failed lint checks for trivial spelling/formatting if you could fix those up. |
The old behaviour would be something like irrespective of terminal size or given --width ... argument (i.e. always 80chars terminal basically), where the new behaviour for the same event becomes depending on the terminal size when no The output for calw and calm isn't changed except that the --width argument now sets the overall width as it does for agenda. So would be a logical thing to write. Let me know if you like more detailed examples.
Those should be fixed. I've changed the long line also to match the formatting and use of %d and % as in |
|
|
||
| # Store overall calendar width and width for day table cells | ||
| self.width['cal'] = int(options.get('width', 80)) | ||
| day_width = int(( self.width['cal'] - 8) / 7) |
There was a problem hiding this comment.
FYI dividing by 7 probably doesn't handle --noweekend exactly right, but looks like that's a preexisting issue and minor.
There was a problem hiding this comment.
you're right with both: it's indeed not handled correctly and is a preexisting issue, but it got moved in this PR.
I've just opened a new PR #826 to fix it.
Fix the width for the description details, both default and as cmdline option, and make sure we don't break the width of the
calwandcalmoutput.The (pretty much undocumented) option
--width/-woption was used for setting the width of a day table cell incalwandcalmbut seemed to also be intended for setting the overall width of thedescriptioninagenda. The latter part was broken and the detailsdescriptionwidth would always default to 80.We change the behaviour to set the overall width of the table, defaulting to the terminal width, both for
calwandcalmand fordescriptiondetails. The width of the day cell is calculated from the overall width.