Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preventing popup "Revision X not being visible in the revision grid" on right mouse button click #10283

Merged
merged 6 commits into from Oct 24, 2022

Conversation

h0lg
Copy link
Contributor

@h0lg h0lg commented Oct 21, 2022

Fixes #10250 by

  • remembering clicked mouse button until node selection events are triggered and
  • patching the info through to only show the popup about Revision X not being visible in the revision grid if the click did not originate from the right mouse button.

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.

@ghost ghost assigned h0lg Oct 21, 2022
@h0lg h0lg changed the title Issue 10250 Preventing popup "Revision X not being visible in the revision grid" on right mouse button click Oct 21, 2022
@RussKie
Copy link
Member

RussKie commented Oct 21, 2022

I don't think we should execute this path at all if the node isn't visible
image

@RussKie
Copy link
Member

RussKie commented Oct 21, 2022

I believe this is all that's required:

diff --git a/GitUI/BranchTreePanel/RepoObjectsTree.cs b/GitUI/BranchTreePanel/RepoObjectsTree.cs
index 41f6e4704..6bb0a5e34 100644
--- a/GitUI/BranchTreePanel/RepoObjectsTree.cs
+++ b/GitUI/BranchTreePanel/RepoObjectsTree.cs
@@ -541,7 +541,13 @@ protected override CommandStatus ExecuteCommand(int cmd)
 
         private void OnNodeSelected(object sender, TreeViewEventArgs e)
         {
-            Node.OnNode<Node>(e.Node, node => node.OnSelected());
+            Node.OnNode<Node>(e.Node, node =>
+            {
+                if (node is not BaseBranchNode branchNode || branchNode.Visible)
+                {
+                    node.OnSelected();
+                }
+            });
         }
 

@RussKie RussKie added the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Oct 22, 2022
@gerhardol
Copy link
Member

I believe this is all that's required:

No
The PR works. It is a hack, even if less hacky then what I played around with

@RussKie
Copy link
Member

RussKie commented Oct 22, 2022 via email

@gerhardol
Copy link
Member

What's missing in my snippet?

Have not debugged why I got the popup

@RussKie
Copy link
Member

RussKie commented Oct 22, 2022 via email

@h0lg
Copy link
Contributor Author

h0lg commented Oct 22, 2022

@RussKie I just tried your solution and it does the job - I don't get any popups either when I open the context menu on hidden refs.

The difference in behavior between the two is that your solution suppresses the popup even if I left-click on a hidden ref while mine doesn't.

@gerhardol Which is the desired behaviour?

@ghost ghost removed the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Oct 22, 2022
@gerhardol
Copy link
Member

I ran various manual tests and observed no popups, so I'm curious what I may have missed.

There are two issues:

  1. There is no popup when clicking a node that is set as not visible.
    -> This is maybe something we may live with
  2. The "visible" property is not always correct. The filter detection is incomplete and check against the grid is done to early.
    -> This is was I happened to test (a little too late in the night). This is fixed in SidePanel: Show Stashes #10258

@RussKie
Copy link
Member

RussKie commented Oct 22, 2022

IMO we shouldn't try to navigate if a ref isn't visible.

@gerhardol
Copy link
Member

IMO we shouldn't try to navigate if a ref isn't visible.

Then go with "avoid selecting", and get #10285 merged.
I would appreciate @mstv comments on the latest changes in #10285 though.

@gerhardol gerhardol added this to the 4.0.0 milestone Oct 22, 2022
@gerhardol
Copy link
Member

Also for 4.0

@h0lg
Copy link
Contributor Author

h0lg commented Oct 22, 2022

IMO we shouldn't try to navigate if a ref isn't visible.

The only draw-back I see is that without the popup the user won't get any feedback as to why nothing happens on left-clicking hidden refs.
I'm personally OK with that - just wanted to point that out.

But it does feel a bit like watering down/neutering this new feedback popup feature right off the bat. You guys be the judges of whether you want to do that or not. I didn't read up on the full reasoning behind the new popup.

@h0lg
Copy link
Contributor Author

h0lg commented Oct 22, 2022

IMO we shouldn't try to navigate if a ref isn't visible.

Are you questioning the new feedback popup feature in general? If so, you may want to revert it altogether and solve #10250 that way...

@gerhardol
Copy link
Member

IMO we shouldn't try to navigate if a ref isn't visible.

Are you questioning the new feedback popup feature in general? If so, you may want to revert it altogether and solve #10250 that way...

I interpreted the comment as "when we know a ref is not visible" and the user have other means of seeing that.
The popup was less used in the initial version of the pop feedback.

@h0lg
Copy link
Contributor Author

h0lg commented Oct 22, 2022

I interpreted the comment as "when we know a ref is not visible" and the user have other means of seeing that.

...and in this case the user has a visual clue by how the hidden ref is drawn in the tree (the slashed eye icon and light gray font).
I understand - thanks for clarifying. I see that RevisionGridControl.GoToRef() is used in other scenarios where the user may not have such a clue.

@h0lg
Copy link
Contributor Author

h0lg commented Oct 22, 2022

I've reverted my solution and added @RussKie's.
Note that local/remote branch and tag nodes also all implement IGitRefAcions, see GitUI\BranchTreePanel\Trees and nodes.cd.
Maybe that's something you want to check for to keep the OnSelected() handlers firing for other nodes implementing BaseBranchNode.

h0lg and others added 6 commits October 23, 2022 16:31
…ection events and used that to prevent popup about Revision not being visible in the revision grid; fixes 10250
…node selection events and used that to prevent popup about Revision not being visible in the revision grid; fixes 10250"

This reverts commit 0855262.
…up about Revision X not being visible in the revision grid; fixes gitextensions#10250
@h0lg
Copy link
Contributor Author

h0lg commented Oct 23, 2022

rebased on master and commented

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.

Merging tomorrow

@gerhardol gerhardol merged commit 31f0c7f into gitextensions:master Oct 24, 2022
@ghost ghost modified the milestones: 4.0.0, vNext Oct 24, 2022
@gerhardol gerhardol modified the milestones: vNext, 4.0.0 Oct 24, 2022
gerhardol pushed a commit that referenced this pull request Oct 24, 2022
…on right mouse button click (#10283)

Do not try to select revisions in the grid if the revision status side panel is not visible.

Co-authored-by: Igor Velikorossov <RussKie@users.noreply.github.com>
(cherry picked from commit 31f0c7f)
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.

Thank you

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.

Right click hidden node raises popup
4 participants