Skip to content
Myr

Defer list rendering until pending event actions are processed

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 8dbb3b3 · Browse files · 1 file+11 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−1 removed

  • other:+11 added−1 removed

1 file+11 added−1 removed

modified:src/terminal.go+11 added-1 removed
390 unmodified lines
391 hasFocusActions bool392 hasLoadActions bool393 hasResizeActions bool394 triggerLoad bool395 pendingReqList bool396 filterSelection bool397 reading bool398 running *util.AtomicBool399 failed *string
1497 unmodified lines
1897 t.filterSelection = false1898 }1899 if t.triggerLoad {1900 t.triggerLoad = false1901 t.pendingReqList = true1902 t.eventChan <- tui.Load.AsEvent()1903 }1904 // Search for the tracked item by nth key1905 // - reload (async): search eagerly, unblock as soon as match is found
42 unmodified lines
1948 switch t.resultMerger.Length() {1949 case 0:1950 zero := tui.Zero.AsEvent()1951 if _, prs := t.keymap[zero]; prs {1952 t.pendingReqList = true1953 t.eventChan <- zero1954 }1955 // --sync, only 'focus' is bound, but no items to focus1956 needActivation = t.suppress && !t.hasResultActions && !t.hasLoadActions && t.hasFocusActions1957 case 1:1958 one := tui.One.AsEvent()1959 if _, prs := t.keymap[one]; prs {1960 t.pendingReqList = true1961 t.eventChan <- one1962 }1963 }1964 }1965 if t.hasResultActions {1966 t.pendingReqList = true1967 t.eventChan <- tui.Result.AsEvent()1968 }1964 updateList := !t.trackBlocked1969 updateList := !t.trackBlocked && !t.pendingReqList1970 updatePrompt := trackWasBlocked && !t.trackBlocked1971 t.mutex.Unlock()19721973 t.reqBox.Set(reqInfo, nil)
5709 unmodified lines
76837684 // Dispatch queued background requests7685 t.dispatchAsync()76867687 if t.pendingReqList {7688 t.pendingReqList = false7689 req(reqList)7690 }76917692 t.mutex.Unlock() // Must be unlocked before touching reqBox76937694 if reload {7695 t.eventBox.Set(EvtSearchNew, *reloadRequest)
222 unmodified lines