mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
Extract a method CommitFilesContext.ReInit
Right now it doesn't do very much yet, but it's still worth it even in this state, I'd say. The function is going to become a bit longer in the next commit, though.
This commit is contained in:
parent
442592a149
commit
a6656e307c
3 changed files with 8 additions and 5 deletions
|
@ -78,3 +78,9 @@ func (self *CommitFilesContext) GetDiffTerminals() []string {
|
|||
func (self *CommitFilesContext) ModelSearchResults(searchStr string, caseSensitive bool) []gocui.SearchPosition {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CommitFilesContext) ReInit(ref types.Ref) {
|
||||
self.SetRef(ref)
|
||||
self.SetTitleRef(ref.Description())
|
||||
self.GetView().Title = self.Title()
|
||||
}
|
||||
|
|
|
@ -285,9 +285,7 @@ func (self *RefreshHelper) refreshCommitsAndCommitFiles() {
|
|||
// For now the awkwardness remains.
|
||||
commit := self.c.Contexts().LocalCommits.GetSelected()
|
||||
if commit != nil && commit.RefName() != "" {
|
||||
self.c.Contexts().CommitFiles.SetRef(commit)
|
||||
self.c.Contexts().CommitFiles.SetTitleRef(commit.Description())
|
||||
self.c.Contexts().CommitFiles.GetView().Title = self.c.Contexts().CommitFiles.Title()
|
||||
self.c.Contexts().CommitFiles.ReInit(commit)
|
||||
_ = self.refreshCommitFilesContext()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,9 +71,8 @@ func (self *SwitchToDiffFilesController) enter(ref types.Ref) error {
|
|||
}
|
||||
}
|
||||
|
||||
commitFilesContext.ReInit(ref)
|
||||
commitFilesContext.SetSelection(0)
|
||||
commitFilesContext.SetRef(ref)
|
||||
commitFilesContext.SetTitleRef(ref.Description())
|
||||
commitFilesContext.SetCanRebase(canRebase)
|
||||
commitFilesContext.SetParentContext(self.context)
|
||||
commitFilesContext.SetWindowName(self.context.GetWindowName())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue