6ad154419b2dd9b1c311527fd2787db6275cb9fc — Elias Naur 11 days ago 7d93a27
ui/layout: rename List.Invert to ScrollToEnd

Much clearer.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
1 files changed, 7 insertions(+), 8 deletions(-)

M ui/layout/list.go
M ui/layout/list.go => ui/layout/list.go +7 -8
@@ 22,9 22,10 @@ // the subsection.
  type List struct {
  	Axis Axis
- 	// Inverted lists stay scrolled to the far end position
- 	// until the user scrolls away.
- 	Invert bool
+ 	// ScrollToEnd instructs the list to stay scrolled to the far end position
+ 	// once reahed. A List with ScrollToEnd enabled also align its content to
+ 	// the end.
+ 	ScrollToEnd bool
  	// Alignment is the cross axis alignment of list elements.
  	Alignment Alignment
  


@@ 78,8 79,6 @@ l.children = l.children[:0]
  	l.cs = cs
  	l.len = len
- 	// Inverted lists scroll to the very end as long as the user hasn't
- 	// scrolled away.
  	if l.scrollToEnd() {
  		l.offset = 0
  		l.first = len


@@ 93,7 92,7 @@ }
  
  func (l *List) scrollToEnd() bool {
- 	return l.Invert && !l.beforeEnd
+ 	return l.ScrollToEnd && !l.beforeEnd
  }
  
  // Dragging reports whether the List is being dragged.


@@ 217,8 216,8 @@ }
  	ops := l.ops
  	pos := -l.offset
- 	// Inverted lists are end aligned.
- 	if space := mainc.Max - size; l.Invert && space > 0 {
+ 	// ScrollToEnd lists lists are end aligned.
+ 	if space := mainc.Max - size; l.ScrollToEnd && space > 0 {
  		pos += space
  	}
  	for _, child := range children {