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

Allow highlight branch by ALT+Click in the grid #8452

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions GitUI/Translation/English.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -9651,6 +9651,10 @@ See the changes in the commit form.</source>
<source>Go to &amp;parent commit</source>
<target />
</trans-unit>
<trans-unit id="HighlightSelectedBranch.Text">
<source>Highlight selected branch (until refresh)</source>
<target />
</trans-unit>
<trans-unit id="NavigateBackward.Text">
<source>Navigate &amp;backward</source>
<target />
Expand Down Expand Up @@ -9719,10 +9723,6 @@ See the changes in the commit form.</source>
<source>&amp;Toggle between artificial and HEAD commits</source>
<target />
</trans-unit>
<trans-unit id="ToggleHighlightSelectedBranch.Text">
<source>Highlight selected branch (until refresh)</source>
<target />
</trans-unit>
<trans-unit id="TopoOrder.Text">
<source>Arrange c&amp;ommits by topo order (ancestor order)</source>
<target />
Expand Down
12 changes: 8 additions & 4 deletions GitUI/UserControls/RevisionGrid/RevisionGridControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,11 @@ private void OnGridViewMouseClick(object sender, MouseEventArgs e)
{
var hti = _gridView.HitTest(e.X, e.Y);
_latestSelectedRowIndex = hti.RowIndex;

if (Control.ModifierKeys.HasFlag(Keys.Alt))
{
HighlightSelectedBranch();
}
}

private void OnGridViewCellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
Expand Down Expand Up @@ -2429,10 +2434,9 @@ internal CommandStatus ExecuteCommand(Command cmd)
return ExecuteCommand((int)cmd);
}

private void ToggleHighlightSelectedBranch()
private void HighlightSelectedBranch()
{
var revision = GetSelectedRevisions().FirstOrDefault();

GitRevision revision = GetSelectedRevisions().FirstOrDefault();
if (revision is null)
{
return;
Expand Down Expand Up @@ -2870,7 +2874,7 @@ protected override CommandStatus ExecuteCommand(int cmd)
case Command.SelectNextForkPointAsDiffBase: SelectNextForkPointAsDiffBase(); break;
case Command.GoToMergeBase: GoToMergeBase(); break;
case Command.GoToChild: goToChildToolStripMenuItem_Click(); break;
case Command.ToggleHighlightSelectedBranch: ToggleHighlightSelectedBranch(); break;
case Command.ToggleHighlightSelectedBranch: HighlightSelectedBranch(); break;
case Command.NextQuickSearch: _quickSearchProvider.NextResult(down: true); break;
case Command.PrevQuickSearch: _quickSearchProvider.NextResult(down: false); break;
case Command.NavigateBackward:
Expand Down
5 changes: 3 additions & 2 deletions GitUI/UserControls/RevisionGrid/RevisionGridMenuCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,10 @@ VIEW menu
},
new MenuCommand
{
Name = "ToggleHighlightSelectedBranch",
Name = "HighlightSelectedBranch",
Text = "Highlight selected branch (until refresh)",
ShortcutKeyDisplayString = GetShortcutKeyDisplayStringFromRevisionGridIfAvailable(RevisionGridControl.Command.ToggleHighlightSelectedBranch),
ShortcutKeyDisplayString = GetShortcutKeyDisplayStringFromRevisionGridIfAvailable(RevisionGridControl.Command.ToggleHighlightSelectedBranch)
+ $", {Keys.Alt}+{Keys.LButton}",
ExecuteAction = () => _revisionGrid.ExecuteCommand(RevisionGridControl.Command.ToggleHighlightSelectedBranch)
},

Expand Down