Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-sticky range selection diff #3869

Merged
merged 15 commits into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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.
  • Loading branch information
stefanhaller committed Aug 28, 2024
commit a6656e307c307f85a93ea3d47064029ed261346c
6 changes: 6 additions & 0 deletions pkg/gui/context/commit_files_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
4 changes: 1 addition & 3 deletions pkg/gui/controllers/helpers/refresh_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/gui/controllers/switch_to_diff_files_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down