[#1223] lens/tui: fix records view input handling
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
parent
b05fb6b767
commit
98215ff06b
1 changed files with 6 additions and 6 deletions
|
@ -171,12 +171,12 @@ func (v *RecordsView) selectLastRecord() {
|
|||
|
||||
func (v *RecordsView) InputHandler() func(event *tcell.EventKey, _ func(p tview.Primitive)) {
|
||||
return v.WrapInputHandler(func(event *tcell.EventKey, _ func(p tview.Primitive)) {
|
||||
switch _, k := event.Modifiers(), event.Key(); {
|
||||
case k == tcell.KeyLeft:
|
||||
switch m, k := event.Modifiers(), event.Key(); {
|
||||
case m == 0 && (k == tcell.KeyLeft || k == tcell.KeyPgUp):
|
||||
v.moveToPrevPage()
|
||||
case k == tcell.KeyRight:
|
||||
case m == 0 && (k == tcell.KeyRight || k == tcell.KeyPgDn):
|
||||
v.moveToNextPage()
|
||||
case k == tcell.KeyDown:
|
||||
case m == 0 && k == tcell.KeyDown:
|
||||
// Need to move onto the next page.
|
||||
if v.selectedRecordIndex+1 == v.lastRecordIndex {
|
||||
v.moveToNextPage()
|
||||
|
@ -187,13 +187,13 @@ func (v *RecordsView) InputHandler() func(event *tcell.EventKey, _ func(p tview.
|
|||
} else {
|
||||
v.selectedRecordIndex++
|
||||
}
|
||||
case k == tcell.KeyUp:
|
||||
case m == 0 && k == tcell.KeyUp:
|
||||
v.selectedRecordIndex = max(v.selectedRecordIndex-1, 0)
|
||||
if v.selectedRecordIndex < v.firstRecordIndex {
|
||||
v.moveToPrevPage()
|
||||
v.selectLastRecord()
|
||||
}
|
||||
case k == tcell.KeyRune && event.Rune() == 'd':
|
||||
case m&tcell.ModCtrl != 0 && k == tcell.KeyRight:
|
||||
current := v.getSelectedItem()
|
||||
if current != nil {
|
||||
v.ui.moveNextPage(NewDetailedView(current.Result.DetailedString()))
|
||||
|
|
Loading…
Reference in a new issue