Skip to content

Commit

Permalink
Implement F3 to open difftool for .png
Browse files Browse the repository at this point in the history
addendum to PR #4848 for issue #4500
  • Loading branch information
mstv committed Dec 2, 2018
1 parent 4138d95 commit 00de6d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions GitUI/CommandsDialogs/FormCommit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1111,13 +1111,14 @@ private void ShowChanges(GitItemStatus item, bool staged)

private async Task SetSelectedDiffAsync(GitItemStatus item, bool staged)
{
Action openWithDiffTool = () => (staged ? stagedOpenDifftoolToolStripMenuItem9 : openWithDifftoolToolStripMenuItem).PerformClick();
if (item.Name.EndsWith(".png"))
{
await SelectedDiff.ViewFileAsync(item.Name);
await SelectedDiff.ViewFileAsync(item.Name, openWithDiffTool);
}
else if (item.IsTracked)
{
SelectedDiff.ViewCurrentChanges(item, staged, () => (staged ? stagedOpenDifftoolToolStripMenuItem9 : openWithDifftoolToolStripMenuItem).PerformClick());
SelectedDiff.ViewCurrentChanges(item, staged, openWithDiffTool);
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions GitUI/Editor/FileViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public ArgumentString GetExtraDiffArguments()
};
}

public Task ViewFileAsync(string fileName)
public Task ViewFileAsync(string fileName, [CanBeNull] Action openWithDifftool = null)
{
return ShowOrDeferAsync(
fileName,
Expand All @@ -352,7 +352,7 @@ public Task ViewFileAsync(string fileName)
getImage: GetImage,
getFileText: GetFileText,
getSubmoduleText: () => LocalizationHelpers.GetSubmoduleText(Module, fileName.TrimEnd('/'), ""),
openWithDifftool: null /* not implemented */));
openWithDifftool));

Image GetImage()
{
Expand Down Expand Up @@ -770,7 +770,7 @@ private Task ViewItemAsync(string fileName, Func<Image> getImage, Func<string> g
}
PictureBox.Image = image == null ? null : DpiUtil.Scale(image);
internalFileViewer.SetText("", () => { });
internalFileViewer.SetText("", openWithDifftool);
});
}

Expand Down

0 comments on commit 00de6d3

Please sign in to comment.