feat(advancedpaste): add auto-copy selection for custom action hotkeys#44767
feat(advancedpaste): add auto-copy selection for custom action hotkeys#44767yeelam-gordon merged 6 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an auto-copy feature for custom action hotkeys in Advanced Paste, enabling users to copy selected text and execute a custom action with a single keyboard shortcut instead of requiring separate copy and paste actions.
Changes:
- Added a new configuration setting
AutoCopySelectionForCustomActionHotkeyto enable/disable automatic copying - Implemented backend logic to send WM_COPY or simulate Ctrl+C when custom action hotkeys are triggered
- Added UI controls and localization strings for the new setting
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| dllmain.cpp | Implements copy selection logic and integrates it into hotkey handling |
| AdvancedPasteProperties.cs | Adds the new boolean property to the settings model |
| AdvancedPasteViewModel.cs | Exposes the setting to the UI with two-way binding |
| AdvancedPastePage.xaml | Adds a checkbox control for the new setting |
| Resources.resw | Provides localized strings for the UI elements |
src/modules/AdvancedPaste/AdvancedPasteModuleInterface/dllmain.cpp
Outdated
Show resolved
Hide resolved
|
The main concern is the corner case - What if copy fail for selection: |
|
Maybe could we stop the processing if copy failed? |
Totally get it. I aware that in the 1st day since half an year ago Hao talked about it. What i push on recently change: |
|
Can we check clipboard sequence to check whether there is a copy happened? If copy failed, we cann stop the processing |
I tried the following before. The above situation make above checking not entirely correct. |
|
Add-Type @" I tried this, and it works for the case you mentioned above, would sequence number help more? |
This comment has been minimized.
This comment has been minimized.
|
Thanks for the suggestion. I’ve updated the auto-copy path to verify success using |
|
Update applied: if auto-copy fails (no clipboard sequence change after retries), |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Thanks!! This looks good to me!! |
5c9c31b to
9fa44c8
Compare
The rebase doesn't work well... just do it right now... |
Summary of the Pull Request
Boosting productivity #2x. Customer mentioned with Custom Action (Shortcut trigger) "We should not need to do two keyboard actions to finish this awesome AI data transformation, instead, just single shortcut should do copy + advanced paste."
This pull request introduces a new feature to the Advanced Paste module that allows users to automatically copy the current selection when triggering a custom action hotkey. The changes include backend logic for sending the copy command, updates to configuration and settings management, and UI additions to expose this option to users.
Feature Addition: Auto-Copy Selection for Custom Action Hotkeys
AutoCopySelectionForCustomActionHotkey, to both the backend (dllmain.cpp,AdvancedPasteProperties.cs) and the settings UI, allowing users to enable or disable automatic copying of the current selection when a custom action hotkey is pressed. [1] [2] [3] [4] [5] [6]Backend Logic and Integration
send_copy_selection()andtry_send_copy_message()methods indllmain.cppto send a WM_COPY message or simulate a Ctrl+C keystroke, ensuring the selected content is copied before executing the custom action.Configuration and State Management
UI and Localization
Refactoring for Hotkey Logic