Fix track-current unset after a combined movement action
Some checks failed
CodeQL / Analyze (go) (push) Has been cancelled
build / build (push) Has been cancelled
Test fzf on macOS / build (push) Has been cancelled

Fix #4649
Close #4663
This commit is contained in:
Junegunn Choi
2026-01-26 11:16:59 +09:00
parent 25b2248f11
commit b389616030
3 changed files with 57 additions and 20 deletions

View File

@@ -292,14 +292,32 @@ func defaultMargin() [4]sizeSpec {
return [4]sizeSpec{}
}
type trackOption int
type trackOption struct {
enabled bool
index int32
}
const (
trackDisabled trackOption = iota
trackEnabled
trackCurrent
var (
trackDisabled = trackOption{false, minItem.Index()}
trackEnabled = trackOption{true, minItem.Index()}
)
func (t trackOption) Disabled() bool {
return !t.enabled
}
func (t trackOption) Global() bool {
return t.enabled && t.index == minItem.Index()
}
func (t trackOption) Current() bool {
return t.enabled && t.index != minItem.Index()
}
func trackCurrent(index int32) trackOption {
return trackOption{true, index}
}
type windowPosition int
const (