mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
Block input while the refresh after moving a rebase todo is in flight
Moving a todo rewrites the todo file and advances the selection synchronously, but the commits model is only rebuilt by the refresh. A second press arriving before that grabs the swapped-with todo from the stale model at the advanced index and moves it back, so holding the key to move a todo several slots misbehaved. Use RefreshBlockingInput so the second press is buffered and replayed once the moved todo list is in place. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
200042a57c
commit
055184f997
|
|
@ -741,7 +741,10 @@ func (self *LocalCommitsController) moveDown(selectedCommits []*models.Commit, s
|
|||
self.context().MoveSelection(1)
|
||||
self.context().HandleFocus(types.OnFocusOpts{ScrollSelectionIntoView: true})
|
||||
|
||||
self.c.Refresh(types.RefreshOptions{
|
||||
// Block input until the refresh has landed: a quick second press must
|
||||
// read the moved todo from the refreshed model, not grab whatever the
|
||||
// advanced selection index points at in the stale one.
|
||||
self.c.RefreshBlockingInput(types.RefreshOptions{
|
||||
Scope: []types.RefreshableView{types.REBASE_COMMITS},
|
||||
CommitSelection: types.KeepCommitSelectionIndex,
|
||||
})
|
||||
|
|
@ -777,7 +780,8 @@ func (self *LocalCommitsController) moveUp(selectedCommits []*models.Commit, sta
|
|||
self.context().MoveSelection(-1)
|
||||
self.context().HandleFocus(types.OnFocusOpts{ScrollSelectionIntoView: true})
|
||||
|
||||
self.c.Refresh(types.RefreshOptions{
|
||||
// Block input for the same reason as in moveDown.
|
||||
self.c.RefreshBlockingInput(types.RefreshOptions{
|
||||
Scope: []types.RefreshableView{types.REBASE_COMMITS},
|
||||
CommitSelection: types.KeepCommitSelectionIndex,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -50,19 +50,11 @@ var MoveTodoDownWithRapidKeypresses = NewIntegrationTest(NewIntegrationTestArgs{
|
|||
Tap(func() {
|
||||
t.Common().ContinueRebase()
|
||||
}).
|
||||
/* EXPECTED:
|
||||
Lines(
|
||||
Contains("commit-03"),
|
||||
Contains("commit-02"),
|
||||
Contains("commit-04"),
|
||||
Contains("commit-01"),
|
||||
)
|
||||
ACTUAL: */
|
||||
Lines(
|
||||
Contains("commit-04"),
|
||||
Contains("commit-03"),
|
||||
Contains("commit-02"),
|
||||
Contains("commit-01"),
|
||||
)
|
||||
},
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue