|
|
@@ -1,8 +1,9 @@
|
|
|
+// search_picker.go implements a fuzzy search overlay for messages in the
|
|
|
+// current channel. Opened via the search keybind, it lets users filter
|
|
|
+// messages by author name and content, then jump to the selected message.
|
|
|
package chat
|
|
|
|
|
|
import (
|
|
|
- "fmt"
|
|
|
-
|
|
|
"github.com/ayn2op/discordo/internal/config"
|
|
|
"github.com/ayn2op/tview"
|
|
|
"github.com/ayn2op/tview/help"
|
|
|
@@ -26,6 +27,7 @@ func newSearchPicker(cfg *config.Config, chatView *Model) *searchPicker {
|
|
|
return sp
|
|
|
}
|
|
|
|
|
|
+// resetBrowse starts the search picker in input mode so users can type a query immediately.
|
|
|
func (sp *searchPicker) resetBrowse() { sp.browseMode = false }
|
|
|
|
|
|
func (sp *searchPicker) HandleEvent(event tview.Event) tview.Command {
|
|
|
@@ -60,7 +62,7 @@ func (sp *searchPicker) update() {
|
|
|
}
|
|
|
items = append(items, picker.Item{
|
|
|
Text: text,
|
|
|
- FilterText: fmt.Sprintf("%s %s", msg.Author.DisplayOrUsername(), msg.Content),
|
|
|
+ FilterText: msg.Author.DisplayOrUsername() + " " + msg.Content,
|
|
|
Reference: i,
|
|
|
})
|
|
|
}
|