'reload' should not preserve multi-selection

This commit is contained in:
Junegunn Choi
2026-03-15 11:30:55 +09:00
parent 17f2aa1a1f
commit 48c4913392

View File

@@ -1858,8 +1858,8 @@ func (t *Terminal) UpdateList(result MatchResult) {
}
if t.revision != newRevision {
if !t.revision.compatible(newRevision) {
// Reloaded: capture selection keys for restoration, then clear
if len(t.idNth) > 0 && t.multi > 0 && len(t.selected) > 0 {
// Reloaded: capture selection keys for restoration, then clear (reload-sync only)
if t.trackSync && len(t.idNth) > 0 && t.multi > 0 && len(t.selected) > 0 {
t.pendingSelections = make(map[string]selectedItem, len(t.selected))
for _, sel := range t.selected {
key := t.trackKeyFor(sel.item, t.idNth)
@@ -7482,13 +7482,15 @@ func (t *Terminal) Loop() error {
reloadSync = a.t == actReloadSync
t.reading = true
if len(t.idNth) > 0 {
t.trackSync = reloadSync
}
// Capture tracking key before reload
if !t.track.Disabled() && len(t.idNth) > 0 {
if item := t.currentItem(); item != nil {
t.trackKey = t.trackKeyFor(item, t.idNth)
t.trackKeyCache = make(map[int32]bool)
t.trackBlocked = true
t.trackSync = reloadSync
if !t.inputless {
t.tui.HideCursor()
}