Skip to content

fix: dispatch Ctrl+V via tunnel preview so editor paste works#200

Merged
fuzzzerd merged 1 commit intomasterfrom
fuzzz/issue-197-copy-paste-in-editor
Apr 28, 2026
Merged

fix: dispatch Ctrl+V via tunnel preview so editor paste works#200
fuzzzerd merged 1 commit intomasterfrom
fuzzz/issue-197-copy-paste-in-editor

Conversation

@fuzzzerd
Copy link
Copy Markdown
Owner

Summary

Closes #197.

The Window-level KeyBinding for PasteFileMakerClipData consumed Ctrl+V before the focused text editor could see it, so plain-text copy/paste inside the script editor and the search box was broken — the global FileMaker-clip paste fired instead.

Fix

Replaced the XAML KeyBinding with a tunnel-phase preview handler in MainWindow code-behind. The handler walks the focused element up the visual tree:

  • Focus is inside a TextBox / TextEditor / TextArea → no-op, the editor handles Ctrl+V natively.
  • Focus is anywhere else (tree, tabs, window background) → consume the key and invoke vm.PasteFileMakerClipData().

Tunnel phase is required because text editors mark Ctrl+V handled in their own KeyDown, so a bubble-phase override would never see the global case.

Why not the alternatives

  • Clipboard-content dispatch (editors only handle Ctrl+V if clipboard has plain text): clipboard reads are async, and FileMaker writes both Unicode Text and Mac-XMSC on copy, so this would never disambiguate.
  • Separate shortcut (e.g., Ctrl+Shift+V for global paste): cleanest design, but a UX change. Left as a future option.

The view concern (focus + routed-event dispatch) stays in code-behind; the action (PasteFileMakerClipData) remains in the VM.

@github-actions
Copy link
Copy Markdown

Test Results

✔️ Tests 1254 / 1254 - passed in 11.8s
✔️ Coverage 78.1% - passed with 70% threshold
📏 14368 / 16856 lines covered 🌿 4883 / 7794 branches covered
🔍 click here for more details

✏️ updated for commit 5a343fa

@fuzzzerd fuzzzerd merged commit be637c4 into master Apr 28, 2026
6 checks passed
@fuzzzerd fuzzzerd deleted the fuzzz/issue-197-copy-paste-in-editor branch April 28, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot copy/paste script lines in a script -- fails as its not a filemaker clip.

1 participant