Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit fff0c48

Browse files
committed
Navigate diff to editor on key press
Simple proof of concept!
1 parent 9a03978 commit fff0c48

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/GitHub.VisualStudio/Views/GitHubPane/PullRequestDetailView.xaml.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ async Task DoDiffFile(IPullRequestFileNode file, bool workingDirectory)
166166
if (!workingDirectory)
167167
{
168168
AddBufferTag(diffViewer.RightView.TextBuffer, session, rightPath, DiffSide.Right);
169+
EnableNavigateToEditor(diffViewer.RightView, file);
169170
}
170171

171172
if (workingDirectory)
@@ -196,6 +197,15 @@ void AddBufferTag(ITextBuffer buffer, IPullRequestSession session, string path,
196197
}
197198
}
198199

200+
void EnableNavigateToEditor(IWpfTextView textView, IPullRequestFileNode file)
201+
{
202+
textView.VisualElement.PreviewKeyDown += async (s, e) =>
203+
{
204+
await DoOpenFile(file, true);
205+
e.Handled = true;
206+
};
207+
}
208+
199209
void ShowErrorInStatusBar(string message, Exception e)
200210
{
201211
var ns = GitHub.VisualStudio.Services.DefaultExportProvider.GetExportedValue<IStatusBarNotificationService>();

0 commit comments

Comments
 (0)