Skip to content

Conversation

mstv
Copy link
Member

@mstv mstv commented Nov 7, 2024

Fixes #12026

Proposed changes

Fixup FileStatusList:

  • Skip unnecessary git-grep box visibility handling (which called BeginInvoke too early)
  • Clear search string on hide of git-grep box

Screenshots

Before

N/A

Test methodology

  • manual

Merge strategy

I agree that the maintainer squash merge this PR (if the commit message is clear).


✒️ I contribute this code under The Developer Certificate of Origin.

@mstv mstv self-assigned this Nov 7, 2024
@mstv mstv requested a review from RussKie November 7, 2024 20:22
Copy link
Member

@RussKie RussKie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@@ -375,6 +378,11 @@ private void SetFindInCommitFilesGitGrepVisibilityImpl(bool visible)
// Adjust sizes "automatically" changed by visibility
cboFindInCommitFilesGitGrep.Top = 0;
}
else if (_formFindInCommitFilesGitGrep?.Visible is false or null && cboFindInCommitFilesGitGrep.Text.Length > 0)
Copy link
Member

@RussKie RussKie Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
else if (_formFindInCommitFilesGitGrep?.Visible is false or null && cboFindInCommitFilesGitGrep.Text.Length > 0)
else if (_formFindInCommitFilesGitGrep?.Visible != true && cboFindInCommitFilesGitGrep.Text.Length > 0)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, must handle null too. See my comment below.

@@ -375,6 +378,11 @@ private void SetFindInCommitFilesGitGrepVisibilityImpl(bool visible)
// Adjust sizes "automatically" changed by visibility
cboFindInCommitFilesGitGrep.Top = 0;
}
else if (_formFindInCommitFilesGitGrep?.Visible is false or null && cboFindInCommitFilesGitGrep.Text.Length > 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer is not true

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I preferred that, too, until I trapped into
image

This made me think about replacing all is not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please explain what you mean...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change in the screenshot should have removed nullable only.
But I got confused by the inverse logic of "is not".
It would have been clearer if the old code had been ?.IsEmpty is true or null.

I have changed the condition for this PR to match the recent code style as requested. We can finish the discussion later and, perhaps, adapt those 5 occurrences.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should probably be is (false or null) and is not true is shorter. But Russkie commented on it and has done that before.

@RussKie RussKie added this to the 5.1.1 milestone Nov 8, 2024
@mstv mstv changed the title fix(Diff View): Avoid exception opening fix(Diff View): Avoid exception on open Nov 8, 2024
@mstv mstv merged commit d772c27 into gitextensions:master Nov 8, 2024
3 of 4 checks passed
@mstv mstv deleted the fix/12026_git_grep_menu branch November 8, 2024 16:09
mstv added a commit that referenced this pull request Nov 8, 2024
and clear search string on hide

Refs: #12028
(cherry picked from commit d772c27)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[NBug] Invoke or BeginInvoke cannot be called on a control until t...
4 participants