File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ type RowSelectionTable[T RowSelectionTableEntry] struct {
5252 entries []* T
5353 entriesMutex sync.Mutex
5454
55+ lastSelectedEntry * T
5556 multiSelectEnabled bool
5657 multiSelectionEntryMap map [string ]* T
5758
@@ -119,7 +120,15 @@ func (c *RowSelectionTable[T]) createLayout() {
119120 table .SetSelectable (true , false )
120121 table .SetSelectionChangedFunc (func (row , column int ) {
121122 selectedEntry := c .GetSelectedEntry ()
123+
124+ if c .lastSelectedEntry != nil && selectedEntry == nil {
125+ // workaround to the table not scrolling to the top when PgUp is pressed and a page jump will
126+ // select the table header row.
127+ table .ScrollToBeginning ()
128+ }
122129 c .selectionChangedCallback (selectedEntry )
130+
131+ c .lastSelectedEntry = selectedEntry
123132 })
124133
125134 table .SetInputCapture (func (event * tcell.EventKey ) * tcell.EventKey {
@@ -477,3 +486,11 @@ func (c *RowSelectionTable[T]) Down() {
477486 c .layout .Select (row + 1 , col )
478487 }
479488}
489+
490+ func (c * RowSelectionTable [T ]) PageUp () {
491+
492+ }
493+
494+ func (c * RowSelectionTable [T ]) PageDown () {
495+
496+ }
You can’t perform that action at this time.
0 commit comments