fix(chat): allow typing with mentions popup and prevent autocomplete deadlock (#782)
This commit is contained in:
parent
3397a4426d
commit
e5a137c018
2 changed files with 18 additions and 7 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue