fix(chat): allow typing with mentions popup and prevent autocomplete deadlock (#782)

This commit is contained in:
ayn2op 2026-03-26 14:04:57 -04:00 • committed by GitHub
parent 3397a4426d
commit e5a137c018
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 7 deletions

View file

@ -24,8 +24,10 @@ func newMentionsList(cfg *config.Config) *mentionsList {
Model: list.NewModel(),
}
m.SetKeybinds(list.Keybinds{
SelectUp: cfg.Keybinds.MentionsList.Up.Keybind,
SelectDown: cfg.Keybinds.MentionsList.Down.Keybind,
SelectUp: cfg.Keybinds.MentionsList.Up.Keybind,
SelectDown: cfg.Keybinds.MentionsList.Down.Keybind,
SelectTop: cfg.Keybinds.MentionsList.Top.Keybind,
SelectBottom: cfg.Keybinds.MentionsList.Bottom.Keybind,
})
m.Box = ui.ConfigureBox(m.Box, &cfg.Theme)

View file

@ -169,7 +169,13 @@ func (mi *messageInput) HandleEvent(event tview.Event) tview.Command {
if mi.cfg.AutocompleteLimit > 0 {
if mi.chat.GetVisible(mentionsListLayerName) {
return mi.mentionsList.HandleEvent(event)
keybinds := mi.cfg.Keybinds.MentionsList
if keybind.Matches(event, keybinds.Up.Keybind) ||
keybind.Matches(event, keybinds.Down.Keybind) ||
keybind.Matches(event, keybinds.Top.Keybind) ||
keybind.Matches(event, keybinds.Bottom.Keybind) {
return mi.mentionsList.HandleEvent(event)
}
}
go mi.chat.app.QueueUpdateDraw(func() { mi.tabSuggestion() })
@ -509,10 +515,13 @@ func (mi *messageInput) searchMember(gID discord.GuildID, name string) {
}
mi.lastSearch = time.Now()
mi.chat.messagesList.waitForChunkEvent()
mi.chat.messagesList.setFetchingChunk(true, 0)
mi.chat.state.MemberState.SearchMember(gID, name)
mi.cache.Create(key, mi.chat.messagesList.waitForChunkEvent())
go func() {
mi.chat.messagesList.waitForChunkEvent()
mi.chat.messagesList.setFetchingChunk(true, 0)
mi.chat.state.MemberState.SearchMember(gID, name)
mi.cache.Create(key, mi.chat.messagesList.waitForChunkEvent())
mi.chat.app.QueueUpdateDraw(func() { mi.tabSuggestion() })
}()
}
func (mi *messageInput) showMentionList() {