diff options
author | Davyd McColl <davydm@gmail.com> | 2021-06-14 10:49:36 +0200 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-07-01 17:13:14 +1000 |
commit | 35f1ccdb1b62e62acd383b4d22c415cac37badf4 (patch) | |
tree | 3694bea16ee46103c04631357314601cea5b1428 /pkg | |
parent | 3dc3174d854b60dcc4da0ecabb0f98adb83ebd53 (diff) |
:recycle: temporarily bypass ignore whitespace for diff view instead of turning the toggle off completely
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/gui/staging_panel.go | 8 | ||||
-rw-r--r-- | pkg/gui/whitespace-toggle.go | 10 |
2 files changed, 3 insertions, 15 deletions
diff --git a/pkg/gui/staging_panel.go b/pkg/gui/staging_panel.go index 69a005688..1fb9e8989 100644 --- a/pkg/gui/staging_panel.go +++ b/pkg/gui/staging_panel.go @@ -33,13 +33,9 @@ func (gui *Gui) refreshStagingPanel(forceSecondaryFocused bool, selectedLineIdx gui.Views.Secondary.Title = gui.Tr.StagedChanges } - // if we were ignoring whitespace, stop doing that so that - // line-by-line diffs work as expected - _ = gui.setIgnoreWhitespaceFlag(false) - // note for custom diffs, we'll need to send a flag here saying not to use the custom diff - diff := gui.GitCommand.WorktreeFileDiff(file, true, secondaryFocused, gui.State.IgnoreWhitespaceInDiffView) - secondaryDiff := gui.GitCommand.WorktreeFileDiff(file, true, !secondaryFocused, gui.State.IgnoreWhitespaceInDiffView) + diff := gui.GitCommand.WorktreeFileDiff(file, true, secondaryFocused, false) + secondaryDiff := gui.GitCommand.WorktreeFileDiff(file, true, !secondaryFocused, false) // if we have e.g. a deleted file with nothing else to the diff will have only // 4-5 lines in which case we'll swap panels diff --git a/pkg/gui/whitespace-toggle.go b/pkg/gui/whitespace-toggle.go index 697770a94..e7df9d879 100644 --- a/pkg/gui/whitespace-toggle.go +++ b/pkg/gui/whitespace-toggle.go @@ -1,15 +1,7 @@ package gui func (gui *Gui) toggleWhitespaceInDiffView() error { - return gui.setIgnoreWhitespaceFlag(!gui.State.IgnoreWhitespaceInDiffView) -} - -func (gui *Gui) setIgnoreWhitespaceFlag(shouldIgnoreWhitespace bool) error { - if gui.State.IgnoreWhitespaceInDiffView == shouldIgnoreWhitespace { - return nil - } - - gui.State.IgnoreWhitespaceInDiffView = shouldIgnoreWhitespace + gui.State.IgnoreWhitespaceInDiffView = !gui.State.IgnoreWhitespaceInDiffView toastMessage := gui.Tr.ShowingWhitespaceInDiffView if gui.State.IgnoreWhitespaceInDiffView { |