Several Fixes

This commit is contained in:
2025-08-27 07:42:24 -05:00
parent e4405a8d6b
commit 4361d7b5cf
6 changed files with 45 additions and 24 deletions

View File

@@ -85,7 +85,6 @@ func (w *Searcher) Init(id string, style tcell.Style) {
func (w *Searcher) Id() string { return w.id }
func (w *Searcher) HandleResize(ev *tcell.EventResize) {
w.w, w.h = ev.Size()
w.Log("Searcher<%s>.HandleResize: %d,%d", w.Id(), w.w, w.h)
// Remove 2 from each for borders
aW, aH := w.w-2, w.h-2
if !w.disableBorder {
@@ -187,7 +186,6 @@ func (w *Searcher) Draw(screen tcell.Screen) {
if !w.disableBorder {
if len(w.title) > 0 {
wh.TitledBorderFilled(w.x, w.y, w.x+w.w, w.y+w.h-1, w.title, wh.BRD_CSIMPLE, dStyle, screen)
// w.Log("Searcher<%s> Bounds: %d,%d -> %d,%d", w.Id(), w.x, w.y, w.x+w.w, w.y+w.h)
} else {
wh.BorderFilled(w.x, w.y, w.x+w.w, w.y+w.h, wh.BRD_CSIMPLE, dStyle, screen)
}
@@ -269,6 +267,8 @@ func (w *Searcher) SetHideOnSelect(t bool) { w.hideOnSelect = t }
func (w *Searcher) SetTitle(ttl string) { w.title = ttl }
func (w *Searcher) SetData(data []string) {
// w.data = data
w.Log("%s: Setting Searcher (filtered)Data (%d length)", w.Id(), len(data))
w.data = data
w.filteredData = data
w.updateFilter()
}
@@ -277,6 +277,7 @@ func (w *Searcher) updateFilter() {
var selVal string
data := []string{}
copy(data, w.filteredData)
w.Log("%s: Setting Searcher Data (%d length)", w.Id(), len(data))
if len(data) > 0 && len(data) > w.cursor {
selVal = data[w.cursor]
}