diff --git a/CHANGELOG.md b/CHANGELOG.md index b414d6f..cdbc3b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -119,6 +119,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 (non-trashed) snips can't be deleted until those snips are removed. The CLI's icon asset and any leftover trashed snips are cleaned up with it. +### Fixed +- **Typing into a Text parameter in the copy flyout.** A Text parameter's box + cleared itself on every keystroke (and Copy never enabled), because the + hidden Choice dropdown in the same row stayed two-way bound to the value and + coerced it to null. Each parameter row now realises only the control its type + needs, so typed values stick, the preview resolves, and Copy enables. + ## [0.1.0-alpha.1] - 2026-05-30 First packaged release. Cuts an alpha to exercise the release pipeline diff --git a/src/Snipdeck.App/Views/ParameterFillDialog.xaml b/src/Snipdeck.App/Views/ParameterFillDialog.xaml index f83ce6e..cb0cc7c 100644 --- a/src/Snipdeck.App/Views/ParameterFillDialog.xaml +++ b/src/Snipdeck.App/Views/ParameterFillDialog.xaml @@ -34,12 +34,20 @@ - - + + + HorizontalAlignment="Stretch" /> diff --git a/tests/Snipdeck.Core.Tests/ViewModels/ParameterFillViewModelTests.cs b/tests/Snipdeck.Core.Tests/ViewModels/ParameterFillViewModelTests.cs index d716e25..2b8b649 100644 --- a/tests/Snipdeck.Core.Tests/ViewModels/ParameterFillViewModelTests.cs +++ b/tests/Snipdeck.Core.Tests/ViewModels/ParameterFillViewModelTests.cs @@ -81,6 +81,28 @@ public void Editing_an_input_refreshes_the_preview_live() Assert.True(vm.IsCopyEnabled); } + [Fact] + public void A_windows_path_value_with_quotes_and_spaces_resolves_and_enables_copy() + { + // Guards the VM/engine side of the copy-flyout text-input fix: a value containing + // quotes, backslashes, spaces and a hyphen must substitute literally, resolve the + // command and enable copy. (The bug it accompanies was a XAML dual-binding that + // reset the value; the engine itself handles such values fine.) + var snip = new Snip + { + CommandTemplate = "snipdeck-importer snipcommand {path} --write", + Parameters = [new Parameter { Name = "path", Type = ParameterType.Text }], + }; + var vm = new ParameterFillViewModel(snip, snip.Parameters); + Assert.False(vm.IsCopyEnabled); + + const string value = "\"C:\\Users\\stuar\\OneDrive - SoftwareOne\\Files\\Storage\\SnipCommand\\snipcommand.db\""; + vm.Inputs[0].Value = value; + + Assert.True(vm.IsCopyEnabled); + Assert.Equal($"snipdeck-importer snipcommand {value} --write", vm.Preview); + } + [Fact] public void Multiple_inputs_resolve_independently() {