diff options
Diffstat (limited to 'pkg/gui/controllers')
-rw-r--r-- | pkg/gui/controllers/commits_files_controller.go | 2 | ||||
-rw-r--r-- | pkg/gui/controllers/files_controller.go | 4 | ||||
-rw-r--r-- | pkg/gui/controllers/helpers/diff_helper.go | 4 | ||||
-rw-r--r-- | pkg/gui/controllers/local_commits_controller.go | 2 | ||||
-rw-r--r-- | pkg/gui/controllers/reflog_commits_controller.go | 2 | ||||
-rw-r--r-- | pkg/gui/controllers/stash_controller.go | 2 | ||||
-rw-r--r-- | pkg/gui/controllers/sub_commits_controller.go | 2 | ||||
-rw-r--r-- | pkg/gui/controllers/submodules_controller.go | 2 | ||||
-rw-r--r-- | pkg/gui/controllers/toggle_whitespace_action.go | 5 |
9 files changed, 14 insertions, 11 deletions
diff --git a/pkg/gui/controllers/commits_files_controller.go b/pkg/gui/controllers/commits_files_controller.go index a1cd6a9ca..c82a051f4 100644 --- a/pkg/gui/controllers/commits_files_controller.go +++ b/pkg/gui/controllers/commits_files_controller.go @@ -114,7 +114,7 @@ func (self *CommitFilesController) GetOnRenderToMain() func() error { from, reverse := self.c.Modes().Diffing.GetFromAndReverseArgsForDiff(ref.ParentRefName()) cmdObj := self.c.Git().WorkingTree.ShowFileDiffCmdObj( - from, to, reverse, node.GetPath(), false, self.c.State().GetIgnoreWhitespaceInDiffView(), + from, to, reverse, node.GetPath(), false, self.c.GetAppState().IgnoreWhitespaceInDiffView, ) task := types.NewRunPtyTask(cmdObj.GetCmd()) diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index 1b5d44080..b557c636f 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -201,7 +201,7 @@ func (self *FilesController) GetOnRenderToMain() func() error { split := self.c.UserConfig.Gui.SplitDiff == "always" || (node.GetHasUnstagedChanges() && node.GetHasStagedChanges()) mainShowsStaged := !split && node.GetHasStagedChanges() - cmdObj := self.c.Git().WorkingTree.WorktreeFileDiffCmdObj(node, false, mainShowsStaged, self.c.State().GetIgnoreWhitespaceInDiffView()) + cmdObj := self.c.Git().WorkingTree.WorktreeFileDiffCmdObj(node, false, mainShowsStaged, self.c.GetAppState().IgnoreWhitespaceInDiffView) title := self.c.Tr.UnstagedChanges if mainShowsStaged { title = self.c.Tr.StagedChanges @@ -216,7 +216,7 @@ func (self *FilesController) GetOnRenderToMain() func() error { } if split { - cmdObj := self.c.Git().WorkingTree.WorktreeFileDiffCmdObj(node, false, true, self.c.State().GetIgnoreWhitespaceInDiffView()) + cmdObj := self.c.Git().WorkingTree.WorktreeFileDiffCmdObj(node, false, true, self.c.GetAppState().IgnoreWhitespaceInDiffView) title := self.c.Tr.StagedChanges if mainShowsStaged { diff --git a/pkg/gui/controllers/helpers/diff_helper.go b/pkg/gui/controllers/helpers/diff_helper.go index 3cf4f5735..bf4b33052 100644 --- a/pkg/gui/controllers/helpers/diff_helper.go +++ b/pkg/gui/controllers/helpers/diff_helper.go @@ -29,7 +29,7 @@ func (self *DiffHelper) DiffArgs() []string { output = append(output, "-R") } - if self.c.State().GetIgnoreWhitespaceInDiffView() { + if self.c.GetAppState().IgnoreWhitespaceInDiffView { output = append(output, "--ignore-all-space") } @@ -113,7 +113,7 @@ func (self *DiffHelper) WithDiffModeCheck(f func() error) error { } func (self *DiffHelper) IgnoringWhitespaceSubTitle() string { - if self.c.State().GetIgnoreWhitespaceInDiffView() { + if self.c.GetAppState().IgnoreWhitespaceInDiffView { return self.c.Tr.IgnoreWhitespaceDiffViewSubTitle } diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index 49f664a29..696e4e717 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -177,7 +177,7 @@ func (self *LocalCommitsController) GetOnRenderToMain() func() error { "ref": commit.Name, })) } else { - cmdObj := self.c.Git().Commit.ShowCmdObj(commit.Sha, self.c.Modes().Filtering.GetPath(), self.c.State().GetIgnoreWhitespaceInDiffView()) + cmdObj := self.c.Git().Commit.ShowCmdObj(commit.Sha, self.c.Modes().Filtering.GetPath(), self.c.GetAppState().IgnoreWhitespaceInDiffView) task = types.NewRunPtyTask(cmdObj.GetCmd()) } diff --git a/pkg/gui/controllers/reflog_commits_controller.go b/pkg/gui/controllers/reflog_commits_controller.go index 735e0434f..512390a6b 100644 --- a/pkg/gui/controllers/reflog_commits_controller.go +++ b/pkg/gui/controllers/reflog_commits_controller.go @@ -37,7 +37,7 @@ func (self *ReflogCommitsController) GetOnRenderToMain() func() error { if commit == nil { task = types.NewRenderStringTask("No reflog history") } else { - cmdObj := self.c.Git().Commit.ShowCmdObj(commit.Sha, self.c.Modes().Filtering.GetPath(), self.c.State().GetIgnoreWhitespaceInDiffView()) + cmdObj := self.c.Git().Commit.ShowCmdObj(commit.Sha, self.c.Modes().Filtering.GetPath(), self.c.GetAppState().IgnoreWhitespaceInDiffView) task = types.NewRunPtyTask(cmdObj.GetCmd()) } diff --git a/pkg/gui/controllers/stash_controller.go b/pkg/gui/controllers/stash_controller.go index 1d8a0bbb0..1b8377f27 100644 --- a/pkg/gui/controllers/stash_controller.go +++ b/pkg/gui/controllers/stash_controller.go @@ -66,7 +66,7 @@ func (self *StashController) GetOnRenderToMain() func() error { task = types.NewRunPtyTask( self.c.Git().Stash.ShowStashEntryCmdObj( stashEntry.Index, - self.c.State().GetIgnoreWhitespaceInDiffView(), + self.c.GetAppState().IgnoreWhitespaceInDiffView, ).GetCmd(), ) } diff --git a/pkg/gui/controllers/sub_commits_controller.go b/pkg/gui/controllers/sub_commits_controller.go index 0855e6689..c11bba089 100644 --- a/pkg/gui/controllers/sub_commits_controller.go +++ b/pkg/gui/controllers/sub_commits_controller.go @@ -38,7 +38,7 @@ func (self *SubCommitsController) GetOnRenderToMain() func() error { if commit == nil { task = types.NewRenderStringTask("No commits") } else { - cmdObj := self.c.Git().Commit.ShowCmdObj(commit.Sha, self.c.Modes().Filtering.GetPath(), self.c.State().GetIgnoreWhitespaceInDiffView()) + cmdObj := self.c.Git().Commit.ShowCmdObj(commit.Sha, self.c.Modes().Filtering.GetPath(), self.c.GetAppState().IgnoreWhitespaceInDiffView) task = types.NewRunPtyTask(cmdObj.GetCmd()) } diff --git a/pkg/gui/controllers/submodules_controller.go b/pkg/gui/controllers/submodules_controller.go index ebf597d3b..06a26af2e 100644 --- a/pkg/gui/controllers/submodules_controller.go +++ b/pkg/gui/controllers/submodules_controller.go @@ -102,7 +102,7 @@ func (self *SubmodulesController) GetOnRenderToMain() func() error { if file == nil { task = types.NewRenderStringTask(prefix) } else { - cmdObj := self.c.Git().WorkingTree.WorktreeFileDiffCmdObj(file, false, !file.HasUnstagedChanges && file.HasStagedChanges, self.c.State().GetIgnoreWhitespaceInDiffView()) + cmdObj := self.c.Git().WorkingTree.WorktreeFileDiffCmdObj(file, false, !file.HasUnstagedChanges && file.HasStagedChanges, self.c.GetAppState().IgnoreWhitespaceInDiffView) task = types.NewRunCommandTaskWithPrefix(cmdObj.GetCmd(), prefix) } } diff --git a/pkg/gui/controllers/toggle_whitespace_action.go b/pkg/gui/controllers/toggle_whitespace_action.go index f501338f4..5e9c1bf1b 100644 --- a/pkg/gui/controllers/toggle_whitespace_action.go +++ b/pkg/gui/controllers/toggle_whitespace_action.go @@ -23,7 +23,10 @@ func (self *ToggleWhitespaceAction) Call() error { return self.c.ErrorMsg(self.c.Tr.IgnoreWhitespaceNotSupportedHere) } - self.c.State().SetIgnoreWhitespaceInDiffView(!self.c.State().GetIgnoreWhitespaceInDiffView()) + self.c.GetAppState().IgnoreWhitespaceInDiffView = !self.c.GetAppState().IgnoreWhitespaceInDiffView + if err := self.c.SaveAppState(); err != nil { + self.c.Log.Errorf("error when saving app state: %v", err) + } return self.c.CurrentSideContext().HandleFocus(types.OnFocusOpts{}) } |