Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 13 additions & 5 deletions src/Snipdeck.App/Views/ParameterFillDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,20 @@
<StackPanel Spacing="4">
<TextBlock Text="{x:Bind Name}"
Style="{ThemeResource CaptionTextBlockStyle}" />
<TextBox Text="{x:Bind Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Visibility="{x:Bind IsText, Converter={StaticResource BoolToVisibility}}" />
<ComboBox ItemsSource="{x:Bind Options}"
<!-- A parameter is either Text or Choice, fixed for the life of the row.
Realise only the relevant control via x:Load: a collapsed-but-loaded
ComboBox stays TwoWay-bound to the same Value and coerces it to null
(its Options never contain a typed value), which clears the TextBox and
leaves the command unresolved. x:Load keeps the unused control unrealised
so its binding never fires. -->
<TextBox x:Name="TextValueBox"
x:Load="{x:Bind IsText}"
Text="{x:Bind Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<ComboBox x:Name="ChoiceValueBox"
x:Load="{x:Bind IsChoice}"
ItemsSource="{x:Bind Options}"
SelectedItem="{x:Bind Value, Mode=TwoWay}"
HorizontalAlignment="Stretch"
Visibility="{x:Bind IsChoice, Converter={StaticResource BoolToVisibility}}" />
HorizontalAlignment="Stretch" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
Loading