aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/listbox.go33
1 files changed, 13 insertions, 20 deletions
diff --git a/app/listbox.go b/app/listbox.go
index 54ced1e8..7d1a4f27 100644
--- a/app/listbox.go
+++ b/app/listbox.go
@@ -229,41 +229,34 @@ func (lb *ListBox) Invalidate() {
}
func (lb *ListBox) Event(event tcell.Event) bool {
+ showFilter := lb.showFilterField()
if event, ok := event.(*tcell.EventKey); ok {
switch event.Key() {
case tcell.KeyLeft:
+ if showFilter {
+ break
+ }
lb.moveHorizontal(-1)
lb.Invalidate()
return true
case tcell.KeyRight:
- lb.moveHorizontal(+1)
- lb.Invalidate()
- return true
- case tcell.KeyCtrlB:
- line := lb.selected[:lb.horizPos]
- fds := strings.Fields(line)
- if len(fds) > 1 {
- lb.moveHorizontal(
- strings.LastIndex(line,
- fds[len(fds)-1]) - lb.horizPos - 1)
- } else {
- lb.horizPos = 0
- }
- lb.Invalidate()
- return true
- case tcell.KeyCtrlW:
- line := lb.selected[lb.horizPos+1:]
- fds := strings.Fields(line)
- if len(fds) > 1 {
- lb.moveHorizontal(strings.Index(line, fds[1]))
+ if showFilter {
+ break
}
+ lb.moveHorizontal(+1)
lb.Invalidate()
return true
case tcell.KeyCtrlA, tcell.KeyHome:
+ if showFilter {
+ break
+ }
lb.horizPos = 0
lb.Invalidate()
return true
case tcell.KeyCtrlE, tcell.KeyEnd:
+ if showFilter {
+ break
+ }
lb.horizPos = len(lb.selected)
lb.Invalidate()
return true