WIP: add compact flag #83
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "caninodev/cview:compact_list"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
Add an option to render the list compactly (without blank lines between
ListItem
s). This flag will be ignored ifshowSecondaryText
is set to true.Thanks for submitting this! I really appreciate it. I have a few ideas and some feedback on the implementation. Let me know what you think.
@ -194,6 +194,10 @@ type List struct {
// The height of the list the last time it was drawn.
height int
// If true, will render each ListItem without blank lines in between. This flag
Could I suggest widening the scope of this feature slightly? A compact list could be a list which, when no list items have secondary text set, will not add a blank line for the missing text, and will render as though
ShowSecondaryText
were false. When an item with secondary text is added, it is as thoughShowSecondaryText
were set to true. I also believe compact should default to true.So to make sure I understand your suggestion:
If a list's list items do not have
SecondaryText
defined, then the list should be rendered compact by default.However, should a list's list items have
SecondaryText
defined, then list should not be rendered compact by default?Or do you mean to say that the list, in both conditions, be rendered compact?
The prior is what I meant. Thanks!
@ -521,1 +526,4 @@
// SetCompactList sets the flag that determines whether a blank line is drawn between
// each ListItem. This flag will be ignored if `showSecondaryText` is true.
func (l *List) SetCompactList(compact bool) {
Please rename as
SetCompact
@ -800,3 +814,3 @@
} else {
if l.currentItem-l.itemOffset >= h {
l.itemOffset = l.currentItem + 1 - h
if l.compact {
To reduce duplication, please update the implementation to simply skip l.showSecondaryText when compact mode is enabled and there is no secondary text in the list. For instance, the condition:
} else if l.showSecondaryText {
could be updated to take l.compact into account. This should allow this feature to be added without adding any additional special cases outside of skipping l.showSecondaryText
add compact flagto WIP: add compact flagTo tell you the truth, I am an aspiring dev. So not sure how to go about doing a proper PR. When I created the PR, I used on the web editing feature on your repo to make it. But to make these changes, I don't know how to use the web interface to edit. Can you walk me through this?
Additionally, I am working on resolving a bug to make this PR feature-complete: namely, that if
selectedAlwaysCentered
flag is false andcompact
flag is true, it doesn't work as it should. It behaves as ifselectedAlwaysCentered
is true.Step 1:
From your project repository, check out a new branch and test the changes.Step 2:
Merge the changes and update on Forgejo.