mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
Make SelectedLine/SelectedLineIdx work in staging/stagingSecondary views
While we try to keep the view's cursor position in sync with the context state's selectedLineIdx (at least when pressing up or down), there are enough situations where the two run out of sync; for example when initially opening the view, or after staging a hunk, or when scrolling the view using the wheel. While it would be possible to fix these situations to keep them always in sync, it doesn't seem worth it, because the view's cursor position isn't really used for anything else. So we rather special-case the SelectedLine/SelectedLineIdx functions of ViewDriver to query the context state's selectedLineIdx directly if it is a patch explorer context.
This commit is contained in:
parent
31fcec16d9
commit
ff2a799200
5 changed files with 34 additions and 4 deletions
|
@ -30,6 +30,10 @@ func (self *fakeGuiDriver) CurrentContext() types.Context {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (self *fakeGuiDriver) ContextForView(viewName string) types.Context {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *fakeGuiDriver) Fail(message string) {
|
||||
self.failureMessage = message
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue