From 6615879957e4b5fc48c17636fff57d2bd16344a9 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 22 Aug 2026 13:29:46 +1000 Subject: [PATCH] Quote ExamDiff's pane titles The two paths were quoted and the /dn1 and /dn2 titles beside them were not, even though both come from the same file names. A snapshot name containing a space - which a parameterised test produces as a matter of course - therefore split at the space and the remainder arrived as extra positional arguments. WinMerge and VisualStudio quote the same titles. --- docs/diff-tool.md | 4 ++-- src/DiffEngine.Tests/diffTools.include.md | 4 ++-- src/DiffEngine/Implementation/ExamDiff.cs | 7 +++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/diff-tool.md b/docs/diff-tool.md index e803b25c..bf2d0b02 100644 --- a/docs/diff-tool.md +++ b/docs/diff-tool.md @@ -397,11 +397,11 @@ DiffTools.UseOrder(DiffTool.ExamDiff); * Example target on left arguments: ``` - "targetFile.txt" "tempFile.txt" /nh /diffonly /dn1:targetFile.txt /dn2:tempFile.txt + "targetFile.txt" "tempFile.txt" /nh /diffonly /dn1:"targetFile.txt" /dn2:"tempFile.txt" ``` * Example target on right arguments: ``` - "tempFile.txt" "targetFile.txt" /nh /diffonly /dn1:tempFile.txt /dn2:targetFile.txt + "tempFile.txt" "targetFile.txt" /nh /diffonly /dn1:"tempFile.txt" /dn2:"targetFile.txt" ``` * Scanned paths: * `%ProgramFiles%\ExamDiff Pro*\ExamDiff.exe` diff --git a/src/DiffEngine.Tests/diffTools.include.md b/src/DiffEngine.Tests/diffTools.include.md index 1a99761c..91c53474 100644 --- a/src/DiffEngine.Tests/diffTools.include.md +++ b/src/DiffEngine.Tests/diffTools.include.md @@ -262,11 +262,11 @@ DiffTools.UseOrder(DiffTool.ExamDiff); * Example target on left arguments: ``` - "targetFile.txt" "tempFile.txt" /nh /diffonly /dn1:targetFile.txt /dn2:tempFile.txt + "targetFile.txt" "tempFile.txt" /nh /diffonly /dn1:"targetFile.txt" /dn2:"tempFile.txt" ``` * Example target on right arguments: ``` - "tempFile.txt" "targetFile.txt" /nh /diffonly /dn1:tempFile.txt /dn2:targetFile.txt + "tempFile.txt" "targetFile.txt" /nh /diffonly /dn1:"tempFile.txt" /dn2:"targetFile.txt" ``` * Scanned paths: * `%ProgramFiles%\ExamDiff Pro*\ExamDiff.exe` diff --git a/src/DiffEngine/Implementation/ExamDiff.cs b/src/DiffEngine/Implementation/ExamDiff.cs index 0c88818a..133e3656 100644 --- a/src/DiffEngine/Implementation/ExamDiff.cs +++ b/src/DiffEngine/Implementation/ExamDiff.cs @@ -6,14 +6,17 @@ static string LeftArguments(string temp, string target) { var tempTitle = Path.GetFileName(temp); var targetTitle = Path.GetFileName(target); - return $"\"{target}\" \"{temp}\" /nh /diffonly /dn1:{targetTitle} /dn2:{tempTitle}"; + // Quoted, like the paths beside them and like WinMerge and VisualStudio do with + // the same titles. A snapshot name with a space in it - which a parameterised + // test produces routinely - otherwise splits into extra positional arguments + return $"\"{target}\" \"{temp}\" /nh /diffonly /dn1:\"{targetTitle}\" /dn2:\"{tempTitle}\""; } static string RightArguments(string temp, string target) { var tempTitle = Path.GetFileName(temp); var targetTitle = Path.GetFileName(target); - return $"\"{temp}\" \"{target}\" /nh /diffonly /dn1:{tempTitle} /dn2:{targetTitle}"; + return $"\"{temp}\" \"{target}\" /nh /diffonly /dn1:\"{tempTitle}\" /dn2:\"{targetTitle}\""; } return new(