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

Commit d74fa01

Browse files
authored
Merge pull request #1580 from github/fixes/navigate-to-editor
Fix navigate to editor.
2 parents 86c7f1b + a4fe246 commit d74fa01

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/GitHub.App/Services/PullRequestEditorService.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ public async Task OpenFile(
102102
if (!workingDirectory)
103103
{
104104
AddBufferTag(buffer, session, fullPath, commitSha, null);
105+
106+
var textView = FindActiveView();
107+
var file = await session.GetFile(relativePath);
108+
EnableNavigateToEditor(textView, session, file);
105109
}
106110
}
107111

@@ -182,6 +186,9 @@ await pullRequestService.ExtractToTempFile(
182186
if (!workingDirectory)
183187
{
184188
AddBufferTag(diffViewer.RightView.TextBuffer, session, rightPath, file.CommitSha, DiffSide.Right);
189+
EnableNavigateToEditor(diffViewer.LeftView, session, file);
190+
EnableNavigateToEditor(diffViewer.RightView, session, file);
191+
EnableNavigateToEditor(diffViewer.InlineView, session, file);
185192
}
186193

187194
if (workingDirectory)
@@ -509,7 +516,9 @@ void ShowInfoMessage(string message)
509516

510517
static string GetAbsolutePath(IPullRequestSession session, IPullRequestSessionFile file)
511518
{
512-
return Path.Combine(session.LocalRepository.LocalPath, file.RelativePath);
519+
var localPath = session.LocalRepository.LocalPath;
520+
var relativePath = file.RelativePath.Replace('/', Path.DirectorySeparatorChar);
521+
return Path.Combine(localPath, relativePath);
513522
}
514523

515524
static IDisposable OpenInProvisionalTab()

0 commit comments

Comments
 (0)