diff options
Diffstat (limited to 'tui')
| -rw-r--r-- | tui/layout.go | 2 | ||||
| -rw-r--r-- | tui/scroll_state.go | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/tui/layout.go b/tui/layout.go index f8ea4bc..d230a87 100644 --- a/tui/layout.go +++ b/tui/layout.go @@ -342,7 +342,7 @@ func (b *Box) computePositions(axis int) { b.Scroll.offset = -p b.Scroll.at = first.id } - if b.Scroll.absolute == 0 { + if b.Scroll.absolute == 0 && !b.Scroll.NoSnap { b.Scroll.at = "" b.Scroll.offset = 0 } diff --git a/tui/scroll_state.go b/tui/scroll_state.go index 75797b1..a712634 100644 --- a/tui/scroll_state.go +++ b/tui/scroll_state.go @@ -6,6 +6,7 @@ type ScrollState struct { absolute int atFirst bool atLast bool + NoSnap bool } func (s *ScrollState) ToStart() { @@ -25,6 +26,10 @@ func (s *ScrollState) Scroll(amnt int) { s.absolute += amnt } +func (s *ScrollState) To(id string) { + s.at = id +} + func (s *ScrollState) ByMouse(ev MouseEvent, reverse bool) { scroll := ev.Scroll * 5 if reverse { |
