Skip to content

Commit

Permalink
fix: not freshList after item deleted;
Browse files Browse the repository at this point in the history
  • Loading branch information
MapoMagpie committed May 21, 2024
1 parent 3ab4842 commit 9d59101
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
12 changes: 5 additions & 7 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,12 @@ func Start(opts *Options) {
}
go dc.Search(rs, resultChan, ctx)
case ret := <-resultChan:
if len(ret) > 0 {
list := make([]tui.ItemRender, len(ret))
for i, entry := range ret {
list[i] = entry
}
listManager.AppendList(list)
hasAppend = true
list := make([]tui.ItemRender, len(ret))
for i, entry := range ret {
list[i] = entry
}
listManager.AppendList(list)
hasAppend = true
case <-timer.C: // debounce, if appended then flush
if hasAppend {
hasAppend = false
Expand Down
6 changes: 2 additions & 4 deletions dict/matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,8 @@ func (m *CacheMatcher) Search(key []rune, list []*Entry, resultChan chan<- []*Ma
}
if (idx%chunkSize == 0 && idx != 0) || idx == listLen-1 {
m2 := matched[lastIdx:]
if len(m2) > 0 {
resultChan <- m2
lastIdx = len(matched)
}
resultChan <- m2
lastIdx = len(matched)
}
}

Expand Down

0 comments on commit 9d59101

Please sign in to comment.