summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-03-26 16:00:05 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-03-26 16:00:05 +0900
commitdac5b6fde1cb6242492e8d27cbea162e37517be0 (patch)
treec3652889cb3d2cb79ddea3536e28e40561370af0 /src
parent998c57442b951bcc1cc2159f60b6267569b03148 (diff)
downloadfzf-dac5b6fde1cb6242492e8d27cbea162e37517be0.tar.gz
Fix info not updated after track-current is disabled due to race condition
Diffstat (limited to 'src')
-rw-r--r--src/terminal.go17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/terminal.go b/src/terminal.go
index ae56c1fe..cd8d4924 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -4625,11 +4625,7 @@ func (t *Terminal) Loop() error {
// U t.uiMutex |
t.uiMutex.Lock()
t.mutex.Lock()
- printInfo := util.RunOnce(func() {
- if !t.resizeIfNeeded() {
- t.printInfo()
- }
- })
+ info := false
for _, key := range keys {
req := util.EventType(key)
value := (*events)[req]
@@ -4637,15 +4633,14 @@ func (t *Terminal) Loop() error {
case reqPrompt:
t.printPrompt()
if t.infoStyle == infoInline || t.infoStyle == infoInlineRight {
- printInfo()
+ info = true
}
case reqInfo:
- printInfo()
+ info = true
case reqList:
t.printList()
currentIndex := t.currentIndex()
focusChanged := focusedIndex != currentIndex
- info := false
if focusChanged && focusedIndex >= 0 && t.track == trackCurrent {
t.track = trackDisabled
info = true
@@ -4657,9 +4652,6 @@ func (t *Terminal) Loop() error {
info = true
}
}
- if info {
- printInfo()
- }
if focusChanged || version != t.version {
version = t.version
focusedIndex = currentIndex
@@ -4751,6 +4743,9 @@ func (t *Terminal) Loop() error {
return
}
}
+ if info && !t.resizeIfNeeded() {
+ t.printInfo()
+ }
t.flush()
t.mutex.Unlock()
t.uiMutex.Unlock()