Widget Update
This commit is contained in:
@@ -105,11 +105,17 @@ func (w *Searcher) HandleKey(ev *tcell.EventKey) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *Searcher) handleKeyUp(ev *tcell.EventKey) bool {
|
func (w *Searcher) handleKeyUp(ev *tcell.EventKey) bool {
|
||||||
|
if len(w.filteredData) == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
w.cursor = ((w.cursor - 1) + len(w.filteredData)) % len(w.filteredData)
|
w.cursor = ((w.cursor - 1) + len(w.filteredData)) % len(w.filteredData)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Searcher) handleKeyDown(ev *tcell.EventKey) bool {
|
func (w *Searcher) handleKeyDown(ev *tcell.EventKey) bool {
|
||||||
|
if len(w.filteredData) == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
w.cursor = ((w.cursor + 1) + len(w.filteredData)) % len(w.filteredData)
|
w.cursor = ((w.cursor + 1) + len(w.filteredData)) % len(w.filteredData)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -262,7 +268,8 @@ func (w *Searcher) MinH() int {
|
|||||||
func (w *Searcher) SetHideOnSelect(t bool) { w.hideOnSelect = t }
|
func (w *Searcher) SetHideOnSelect(t bool) { w.hideOnSelect = t }
|
||||||
func (w *Searcher) SetTitle(ttl string) { w.title = ttl }
|
func (w *Searcher) SetTitle(ttl string) { w.title = ttl }
|
||||||
func (w *Searcher) SetData(data []string) {
|
func (w *Searcher) SetData(data []string) {
|
||||||
w.data = data
|
// w.data = data
|
||||||
|
w.filteredData = data
|
||||||
w.updateFilter()
|
w.updateFilter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user