Skip to content

Fix issue where ignore-whitespace can't be toggled (#2435) - #2436

Merged
love-linger merged 1 commit into
sourcegit-scm:developfrom
goran-w:fix_diff_toggle_ignore_whitespace
Jun 12, 2026
Merged

Fix issue where ignore-whitespace can't be toggled (#2435)#2436
love-linger merged 1 commit into
sourcegit-scm:developfrom
goran-w:fix_diff_toggle_ignore_whitespace

Conversation

@goran-w

@goran-w goran-w commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Also move the toggle-button to avoid having it jumping around when toggled (which is a UI-design no-no).

This fixes issue #2435.

(Additionally, renamed nearby variable from _entireFileLine to _entireFileLines, for clarity and consistency with variable _unifiedLines.)

@goran-w goran-w changed the title Fix issue where ignore-whitespace can't be toggled Jun 12, 2026
@love-linger

Copy link
Copy Markdown
Collaborator
  • Please run dotnet format src/SourceGit.csproj first
  • I'd like to change the CheckSettings to
var pref = Preferences.Instance;

if (Content is TextDiffContext ctx)
{
    if ((pref.UseFullTextDiff && _info.UnifiedLines != _entireFileLine) ||
        (!pref.UseFullTextDiff && _info.UnifiedLines == _entireFileLine) ||
        (pref.IgnoreWhitespaceChangesInDiff != _info.IgnoreWhitespace))
    {
        LoadContent();
        return;
    }

    if (ctx.IsSideBySide() != pref.UseSideBySideDiff)
        Content = ctx.SwitchMode();
}
else if (Content is Models.NoOrEOLChange)
{
    if (pref.IgnoreWhitespaceChangesInDiff != _info.IgnoreWhitespace)
        LoadContent();
}
@goran-w
goran-w force-pushed the fix_diff_toggle_ignore_whitespace branch from 34e919d to 161d24f Compare June 12, 2026 07:19
@love-linger love-linger self-assigned this Jun 12, 2026
…button to avoid it jumping around

(Additionally, renamed nearby variable from _entireFileLine to _entireFileLines, for clarity and consistency with variable _unifiedLines.)
@goran-w
goran-w force-pushed the fix_diff_toggle_ignore_whitespace branch from 161d24f to 85220d3 Compare June 12, 2026 07:22
@love-linger love-linger added the bug Something isn't working label Jun 12, 2026
@goran-w

goran-w commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author
  • Please run dotnet format src/SourceGit.csproj first

Fixed. But could we have this format step run automatically when building in Visual Studio? It's annoying when a PR check fails because of a missed step that could've been automated...

  • I'd like to change the CheckSettings to

Done.

@love-linger

Copy link
Copy Markdown
Collaborator

But could we have this format step run automatically when building in Visual Studio? It's annoying when a PR check fails because of a missed step that could've been automated

I'm not sure if we add some pre-build task will work for all IDEs. Instead, before I push something to this repository, I'll run a custom action to do this job.

image
@love-linger
love-linger merged commit e6170f8 into sourcegit-scm:develop Jun 12, 2026
14 checks passed
@goran-w
goran-w deleted the fix_diff_toggle_ignore_whitespace branch June 12, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

2 participants