mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-10-05 21:46:49 -04:00
EndBlockingEvents dispatches the keys buffered during a block from inside its own call, so a keybinding handler runs in the middle of whatever the caller was doing. If a caller ends the block partway through updating the screen, that handler acts on state the caller has yet to finish writing. No caller does that today; both of them end their block from a UI-thread callback of their own, with nothing left to do afterwards. The commit after this one adds a caller that can. It ends the block from a render restore, and a render of the two main panes resolves that restore halfway through laying the panes out. Queue the replay through Update instead, so the buffered keys arrive on a later pass of the loop, as they would have if the user had pressed them then. Input stays withheld until that pass runs. Gui events are dispatched in preference to queued work, so a key pressed in between would otherwise be handled ahead of the keys buffered before it. The replay's error now reaches the error handler along with every other handler's, and EndBlockingEvents has nothing left to return.