Skip to content

Conversation

RussKie
Copy link
Member

@RussKie RussKie commented Aug 27, 2024

Addendum to #11350

Proposed changes

  • Expose "git-grep" search in Settings
  • Expose "git-grep" search in the context menu

Screenshots

Before

image
image

After

image
image
image

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.

@RussKie RussKie requested review from gerhardol and mstv August 27, 2024 09:52
@RussKie RussKie added this to the 5.0.0 milestone Aug 27, 2024
@gerhardol
Copy link
Member

Git grep searchbox was somehow hidden on your request, you found it confusing.
To search from the popup, there is a context menu. This is similar to find in diff, Ctrl-F.

image

You can enable the searchbox in the popup, not much in the help though...

image

I do not oppose a more direct configuration of the searchbox, but the names are not aligned. Search commit could be renamed too, maybe git-grep should be mentioned at least.

I do not

Copy link
Member

@gerhardol gerhardol left a comment

Choose a reason for hiding this comment

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

Is this really needed if the popup is the primary way to use git-grep?

@mstv
Copy link
Member

mstv commented Aug 27, 2024

My 2ct:

  • Having the option in the settings dialog might be useful and will be discoverable.
  • The second context menu item is too redundant to me.
  • The term "Search files in commit (git-grep)" could be used thoroughly.

@gerhardol
Copy link
Member

My 2ct:

Fine for me

@RussKie
Copy link
Member Author

RussKie commented Aug 28, 2024

  • The term "Search files in commit (git-grep)" could be used thoroughly.

I wasn't sure on the wording we wanted to use; this is a good suggestion.

  • The second context menu item is too redundant to me.

The reason I added it was without it a user has to open the popup to enable/disable the git-grep search box. That's not a good UX.

Is this really needed if the popup is the primary way to use git-grep?

I believe there is - the popup allows to specify additional git-grep option, whilst the search box doesn't.

Git grep searchbox was somehow hidden on your request, you found it confusing.

Yes, I remember that, and I still think having two of those visible by default isn't great. But needing to open another dialog just to show the search box is equally not a good UX.

@RussKie
Copy link
Member Author

RussKie commented Aug 28, 2024

Not exactly related, but can you help me understand why we have mnemonics in the context menu? The contextmenu items can't be invoked via the mnemonics, only via the shortcuts. ...or am I missing something?

Not to mention we have conflicting shortcuts and mnemonics:
image

@mstv
Copy link
Member

mstv commented Aug 28, 2024

can you help me understand why we have mnemonics in the context menu? The contextmenu items can't be invoked via the mnemonics, only via the shortcuts. ...or am I missing something?

  1. There is a dedicated key for opening the context menu (right of the space bar). Shift+F10 opens it, too.
  2. Right click + letter is much quicker than aiming with the mouse (at least to me).

@RussKie
Copy link
Member Author

RussKie commented Aug 28, 2024

  1. There is a dedicated key for opening the context menu (right of the space bar). Shift+F10 opens it, too.

My keyboard doesn't have a dedicated button, though I think I saw such keyboards.
Thank you for the Shift+F10 tip (though I feel like I should have known about it).

2. Right click + letter is much quicker than aiming with the mouse (at least to me).

:-O

@mstv
Copy link
Member

mstv commented Aug 28, 2024

Yet another text to be aligned:

image

And isn't it a "find box" then, too?

image

@gerhardol
Copy link
Member

I rather use SearchCommit or "SearchCommit (git-grep)" in UI and SearchCommitGitGrep in code.
While git-grep refers to the Git functionality, I have got the feedback that SearchCommit is a better description.
There is already "Find file" in both RevDiff and RevFileTree, that have different functionality.

The search box was considered to be an advanced usage (but I use it daily) why the RevDiff context menu may be redundant. But it can stay if the name is aligned with the invocation of the popup.


private void EnableSearchForList(bool enable)
public void ToggleGitGrepSearch(bool visible)
Copy link
Member

Choose a reason for hiding this comment

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

Toggle is not a good name, it updates the status at every update.
I have some doubts for some of the changes, not time to investigate today....

Copy link
Member Author

Choose a reason for hiding this comment

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

it updates the status at every update.

Which "status" are you talking about?

@RussKie
Copy link
Member Author

RussKie commented Aug 29, 2024

I rather use SearchCommit or "SearchCommit (git-grep)" in UI and SearchCommitGitGrep in code.

Sounds good, I'll change

@RussKie
Copy link
Member Author

RussKie commented Aug 29, 2024

Yet another text to be aligned:

image

And isn't it a "find box" then, too?

image

Missed that text, thanks

@RussKie
Copy link
Member Author

RussKie commented Aug 29, 2024

image
image
image

@gerhardol
Copy link
Member

My preference is still Search commit (git-grep).
Also, it is not a filter for Diff (but the commit). So the settings/menu/popup-box could be Show 'Search commit (git-grep)' box
Box text has nothing about regex, maybe not needed, I consider 'files' less important: Search commit files with git-grep -> Search commit (git-grep)

Copy link
Member

@gerhardol gerhardol left a comment

Choose a reason for hiding this comment

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

+1 One question on the fuctionality and suggestion to change UI text slightly, otherwise fine.

@RussKie
Copy link
Member Author

RussKie commented Sep 2, 2024

Updated

Copy link
Member

@mstv mstv left a comment

Choose a reason for hiding this comment

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

If you are too busy, I can commit the proposals.

The current state is too inconsistent to me:

image

showSearchCommitGitGrepDialogToolStripMenuItem.Image = Properties.Images.ViewFile;
showSearchCommitGitGrepDialogToolStripMenuItem.Name = "showSearchCommitGitGrepDialogToolStripMenuItem";
showSearchCommitGitGrepDialogToolStripMenuItem.Size = new Size(262, 22);
showSearchCommitGitGrepDialogToolStripMenuItem.Text = "Search commit files with git-grep...";
Copy link
Member

Choose a reason for hiding this comment

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

This function does not "find files" but "searches for text in files of the commit's tree".
That's why we agreed to "search files in commit" in the initial PR.

Suggested change
showSearchCommitGitGrepDialogToolStripMenuItem.Text = "Search commit files with git-grep...";
showSearchCommitGitGrepDialogToolStripMenuItem.Text = "Sear&ch files in commit with git-grep...";

Copy link
Member

Choose a reason for hiding this comment

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

I think "Search commit (git-grep)" is fine too, slightly shorter.

Copy link
Member Author

Choose a reason for hiding this comment

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

In general, I completely disagree with the chosen wording.
We have an existing form and wording for searching in files:
image
image

I was aligning the wording with that to provide consistent UX. Now, we have "File file.." and "Search files..." - what's the difference? Both search content in commit files. Different algorithms, but ultimately the same operation - search in files.

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 suggested wording is generally different to what other apps use - e.g., VS:
image

Copy link
Member

Choose a reason for hiding this comment

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

I was aligning the wording with that to provide consistent UX. Now, we have "File file.." and "Search files..." - what's the difference? Both search content in commit files. Different algorithms, but ultimately the same operation - search in files.

Find is searching the files in the diff
Search commit is searching the files in the commit

It is really the existing Find that is different from "search in working directory" for search-all apps.
But changing functionality may confuse users. Maybe that test should be changed though.
regardless, I want commit in the label to differentiate this addition. "Find files in commit (git-grep)" is longer than "Search commit (git-grep)". (having git-grep in the label is a bonus)

Copy link
Member Author

Choose a reason for hiding this comment

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

Will this work?

image
image

Copy link
Member

Choose a reason for hiding this comment

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

I would like to have commit in the name
Find file is not a fileter (it would be if in the file-tree)

So the highlighted names (similar for popup), my suggestions

Find in files for commit (git-grep) with regular expression
Find in files for commit (git-grep)...
Show 'Find in files for commit (git-grep)' box

Copy link
Member Author

Choose a reason for hiding this comment

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

@gerhardol sounds good.
@mstv would it work for you?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, this will work for me.

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 pushed the changes and updated the screenshots in the first post.

I kept the text in watermark a) for consistency reasons and b) the context here is obvious - the commit - so the word is redundant.
image

This drove the wording in the context menu, the Settings and in the Find dialog.

Copy link
Member

@mstv mstv left a comment

Choose a reason for hiding this comment

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

I buy the wording.

showFindInCommitFilesGitGrepFilterToolStripMenuItem.CheckOnClick = true;
showFindInCommitFilesGitGrepFilterToolStripMenuItem.Name = "showFindInCommitFilesGitGrepFilterToolStripMenuItem";
showFindInCommitFilesGitGrepFilterToolStripMenuItem.Size = new Size(262, 22);
showFindInCommitFilesGitGrepFilterToolStripMenuItem.Text = "Show 'Filter files using git-grep regular expression'";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
showFindInCommitFilesGitGrepFilterToolStripMenuItem.Text = "Show 'Filter files using git-grep regular expression'";
showFindInCommitFilesGitGrepFilterToolStripMenuItem.Text = "Show 'Fi&lter files using git-grep regular expression'";

Copy link
Member

Choose a reason for hiding this comment

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

Show 'Find files in commit using git-grep regular expression'";

Copy link
Member Author

Choose a reason for hiding this comment

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

No, calling it "Find files.." makes it inconsistent both visually and conceptually.

Both controls have consistent wording:
image

And conceptually both of these controls filter the list of files - one filters by file name and the other filters by content. By both perform the same kind of operation - filter the list of files.

Also, there's a semantical difference between "find" and "filter". The latter reduces a given list based on criteria, whilst the former locates requested items. And this control is about reducing the list of commit files in the UI based on a search string.

Copy link
Member Author

Choose a reason for hiding this comment

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

🤔 Perhaps the watermark in the second control should be reworded to "Filter files by name using regul...."

@@ -3,12 +3,12 @@

namespace GitUI
{
partial class FormSearchCommit
partial class FormFindInCommitFilesGitGrep
Copy link
Member

Choose a reason for hiding this comment

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

"Find" is missing in the file name.
Though as we use "git-grep" in the UI, it should suffice to use just "GitGrep" internally, i.e.

Suggested change
partial class FormFindInCommitFilesGitGrep
partial class FormGitGrep

Copy link
Member Author

Choose a reason for hiding this comment

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

Similar reasoning as in #11858 (comment) - this rename won't add any value but will increase inconsistency, which will make it harder to build a mental picture when working with the codebase.

private Rectangle _dragBoxFromMouseDown;
private IDisposable? _selectedIndexChangeSubscription;
private IDisposable? _diffListSortSubscription;
private FormSearchCommit _formSearchCommit;
private FormFindInCommitFilesGitGrep _formFindFileGitGrepCommit;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
private FormFindInCommitFilesGitGrep _formFindFileGitGrepCommit;
private FormFindInCommitFilesGitGrep _formGitGrep;

showFindInCommitFilesGitGrepFilterToolStripMenuItem.CheckOnClick = true;
showFindInCommitFilesGitGrepFilterToolStripMenuItem.Name = "showFindInCommitFilesGitGrepFilterToolStripMenuItem";
showFindInCommitFilesGitGrepFilterToolStripMenuItem.Size = new Size(262, 22);
showFindInCommitFilesGitGrepFilterToolStripMenuItem.Text = "Show 'Filter files using git-grep regular expression'";
Copy link
Member

Choose a reason for hiding this comment

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

Show 'Find files in commit using git-grep regular expression'";

Copy link
Member

@gerhardol gerhardol left a comment

Choose a reason for hiding this comment

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

Pushed an update, aligning the names

FindInCommitFilesGitGrep in names (not Using)
Find in commit files using git-grep in texts

It would had been easier if we aligned on names before the changes (even better when handling the PR, but that will not always happen).

Copy link
Member

@mstv mstv left a comment

Choose a reason for hiding this comment

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

image

The "Show '...'" checkbox should be left aligned.

//
AcceptButton = btnSearch;
AutoScaleDimensions = new SizeF(96F, 96F);
AutoScaleMode = AutoScaleMode.Dpi;
ClientSize = new Size(419, 144);
ClientSize = new Size(425, 144);
Copy link
Member

Choose a reason for hiding this comment

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

Height needs to be adapted.

Copy link
Member

@gerhardol gerhardol Sep 18, 2024

Choose a reason for hiding this comment

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

shortened the text. This could still be an issue in some translations (French and German for instance)
This is positioned automatically and will not go further left

@gerhardol
Copy link
Member

image

image

Copy link
Member

@mstv mstv left a comment

Choose a reason for hiding this comment

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

Trivial MC (adjacent changes) to be resolved yet.

@gerhardol
Copy link
Member

Trivial MC (adjacent changes) to be resolved yet.

Since you have reviewed, I will squash and rebase tomorrow unless @RussKie protests

@gerhardol
Copy link
Member

Additional: I thought we discussed naming a lot for the original PR before we settled on something.
However, the additional discussions and changes back and forward in this PR has required even more time.
Naming is hard.

@RussKie
Copy link
Member Author

RussKie commented Sep 20, 2024

Additional: I thought we discussed naming a lot for the original PR before we settled on something. However, the additional discussions and changes back and forward in this PR has required even more time. Naming is hard.

We did but some features are hard to appreciate without actively using those first. Naming and UI are hard indeed.

@gerhardol
Copy link
Member

@mstv Do you want to add your latest tweaks too?

@mstv
Copy link
Member

mstv commented Sep 20, 2024

@mstv Do you want to add your latest tweaks too?

I hesitated but a774285 and a774285 belong to this PR - pushing.
The third one is worth a separate PR.

showFindInCommitFilesGitGrepToolStripMenuItem,
toolStripSeparatorScript,
runScriptToolStripMenuItem});
DiffContextMenu.Items.AddRange(new ToolStripItem[] { diffUpdateSubmoduleMenuItem, diffResetSubmoduleChanges, diffStashSubmoduleChangesToolStripMenuItem, diffCommitSubmoduleChanges, submoduleStripSeparator, stageFileToolStripMenuItem, unstageFileToolStripMenuItem, resetFileToToolStripMenuItem, cherryPickSelectedDiffFileToolStripMenuItem, toolStripSeparator32, openWithDifftoolToolStripMenuItem, diffOpenWorkingDirectoryFileWithToolStripMenuItem, diffOpenRevisionFileToolStripMenuItem, diffOpenRevisionFileWithToolStripMenuItem, saveAsToolStripMenuItem1, diffEditWorkingDirectoryFileToolStripMenuItem, diffDeleteFileToolStripMenuItem, diffToolStripSeparator13, copyPathsToolStripMenuItem, openContainingFolderToolStripMenuItem, toolStripSeparator33, diffShowInFileTreeToolStripMenuItem, diffFilterFileInGridToolStripMenuItem, fileHistoryDiffToolstripMenuItem, blameToolStripMenuItem, findInDiffToolStripMenuItem, showFindInCommitFilesGitGrepDialogToolStripMenuItem, showFindInCommitFilesGitGrepToolStripMenuItem, toolStripSeparatorScript, runScriptToolStripMenuItem });
Copy link
Member

Choose a reason for hiding this comment

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

Why is the format as this?
I can use difftastic to see that the order is the same but it seem unneeded.

Otherwise no comment on the changes

Copy link
Member

Choose a reason for hiding this comment

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

Why is the format as this?

As mentioned in the commit message "chore(RevisionDiffControl): Saved without changes using Designer 17.11.3".
Don't ask me!

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 to revert this change

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 to revert this change

The next time someone needs to use the designer, the problem will pop up again.
And it already has: I have already had a hard evening rebasing and merging designer files because pull request reviews are not finished or do not happen.

Copy link
Member

@mstv mstv Sep 27, 2024

Choose a reason for hiding this comment

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

reverted because there are is another nonsense change by the Designer to be manually reverted.

Any further objections / vetos, @gitextensions/git-extensions-team?

Copy link
Member

Choose a reason for hiding this comment

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

merge

RussKie and others added 2 commits September 27, 2024 22:56
Align names:
FindInCommitFilesGitGrep in names (not Using)
Find in commit files using git-grep in texts

Refs: gitextensions#11858, addendum to gitextensions#11350
@mstv mstv merged commit ad4bce2 into gitextensions:master Sep 27, 2024
2 of 4 checks passed
@RussKie RussKie deleted the gitgrep branch April 5, 2025 08:27
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.

3 participants