-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Add support for Shift-Delete, Ctrl-Insert and Shift-Insert #178561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Shift-Delete, Ctrl-Insert and Shift-Insert #178561
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds support for IBM CUA style clipboard shortcuts (Shift+Delete for cut, Ctrl+Insert for copy, and Shift+Insert for paste) on non-Apple platforms. The implementation correctly adds these shortcuts to the common shortcuts map.
My review focuses on two main points: improving the clarity of an overridden shortcut and adding test coverage for the new functionality, both of which are guided by the repository's style guide. I've provided a detailed comment with a code suggestion to address these.
|
Alright, this is now considerably more nuanced.
All tests pass. |
bleroux
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for this great contribution 🙏
Some minor nits and see my comment about the fluent API.
| // Xerox/Apple: ^X ^C ^V | ||
| // -> Standard on Windows | ||
| // -> Standard on Linux | ||
| // -> Standard on OS X (with Command as modifier) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // -> Standard on OS X (with Command as modifier) | |
| // -> Standard on macOS (with Command as modifier) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In context here, these aren't the enum TargetPlatform members. I did a quick search of the source code and found precedent elsewhere for a human-readable version being expressed as Mac OS X (change_mach_o_flags.py, util.dart under web_ui, ax_platform_node.h, etc.).
packages/flutter/lib/src/widgets/default_text_editing_shortcuts.dart
Outdated
Show resolved
Hide resolved
packages/flutter/test/widgets/default_text_editing_shortcuts_test.dart
Outdated
Show resolved
Hide resolved
The |
|
About the ci.yaml validation failure, usually rebasing the PR to the tip of the tree fixes it, can you try? |
- Added SingleActivator mappings for Shift-Delete, Ctrl-Insert and Shift-Insert (equivalent to ^X ^C ^V). - Added comment blocks explaining the provenance.
…d" in default_text_editing_shortcuts.dart.
…delete the character forward in default_text_editing_shortcuts.dart.
- Moved the clipboard shortcuts into their own dedicated map _clipboardShortcuts. - Updated _androidShortcuts, _linuxShortcuts and _windowsShortcuts to include _clipboardShortcuts. - Updated _webDisablingTextShortcuts to generate disabling shortcuts dynamically for everything in _clipboardShortcuts, removing the explicit ^X, ^C and ^V.
… in widget_tester.dart to allow fluent syntax for configuring a specific set of target variants. Updated clipboard shortcuts tests in default_text_editing_shortcuts_test.dart to target desktop except macOS, and android. Updated ActionSpyState in default_text_editing_shortcuts_test.dart to capture the intent for CopySelectionTextIntent and PasteTextIntent.
…shortcuts_test.dart for clarity.
… a SingleActivator line moved out of the pressShift loop.
…test_editing_shortcuts_test.dart.
…o match similar references elsewhere in the codebase. Removed the fluent TargetPlatformVariant syntax and replaced its uses with explicit sets.
61a9d6f to
d3fb297
Compare
loic-sharma
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
|
autosubmit label was removed for flutter/flutter/178561, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR. |
Roll Flutter from 60d8165b11e2 to 13b2b912c909 (34 revisions) flutter/flutter@60d8165...13b2b91 2026-01-03 [email protected] Roll Skia from 229239fde9e9 to 2f257bbea23a (1 revision) (flutter/flutter#180461) 2026-01-03 [email protected] Roll Dart SDK from be125a188f41 to 8e711d05b844 (1 revision) (flutter/flutter#180460) 2026-01-03 [email protected] Roll Dart SDK from 0e6419d14382 to be125a188f41 (1 revision) (flutter/flutter#180454) 2026-01-02 [email protected] Roll Dart SDK from 5e4b7dc3a134 to 0e6419d14382 (4 revisions) (flutter/flutter#180449) 2026-01-02 [email protected] Roll Skia from 5a8d480365e2 to 229239fde9e9 (9 revisions) (flutter/flutter#180448) 2026-01-02 [email protected] Relands "Feat: Add a11y for loading indicators (#165173)" (flutter/flutter#178402) 2026-01-02 [email protected] Add SK_SUPPORT_LEGACY_UNSPANNED_GRADIENTS to SkUserConfig.h (flutter/flutter#180443) 2026-01-02 [email protected] Some cleanup of cross library test imports (flutter/flutter#177029) 2026-01-02 [email protected] Roll Dart SDK from df175c998021 to 5e4b7dc3a134 (1 revision) (flutter/flutter#180366) 2026-01-02 [email protected] Roll Fuchsia Linux SDK from nzgy72aZ9kvHxTDM6... to 1pPgo5DrQ5ITdz3Uy... (flutter/flutter#180438) 2026-01-01 [email protected] Roll Fuchsia Linux SDK from 23suNuzNQCwRbDrys... to nzgy72aZ9kvHxTDM6... (flutter/flutter#180424) 2025-12-31 [email protected] Remove @OverRide annotations from things which are not overrides (flutter/flutter#180417) 2025-12-31 [email protected] Roll Fuchsia Linux SDK from t1eBl_kzKGV5K28OU... to 23suNuzNQCwRbDrys... (flutter/flutter#180409) 2025-12-31 [email protected] Roll Skia from 8851d5318c9d to 5a8d480365e2 (1 revision) (flutter/flutter#180400) 2025-12-31 [email protected] Make sure that a DecoratedBox doesn't crash in 0x0 environment (flutter/flutter#180329) 2025-12-31 [email protected] Roll Skia from d0e12d575173 to 8851d5318c9d (2 revisions) (flutter/flutter#180399) 2025-12-31 [email protected] Improve Container color/decoration error message clarity (flutter/flutter#178823) 2025-12-30 [email protected] Make sure that a CheckedModeBanner doesn't crash in 0x0 environment (flutter/flutter#180280) 2025-12-30 [email protected] Roll Skia from 32c27424accb to d0e12d575173 (1 revision) (flutter/flutter#180394) 2025-12-30 [email protected] [Framework] iOS style blurring and `ImageFilterConfig` (flutter/flutter#175473) 2025-12-30 [email protected] Fix issue with getUniformFloat crashing with hot reload (flutter/flutter#180138) 2025-12-30 [email protected] Test cross import lint (flutter/flutter#178693) 2025-12-30 [email protected] Roll Skia from d64da765cee6 to 32c27424accb (1 revision) (flutter/flutter#180393) 2025-12-30 [email protected] Roll Skia from 4c438e0537fc to d64da765cee6 (1 revision) (flutter/flutter#180390) 2025-12-30 [email protected] Roll Packages from b3c3ca8 to 30dd810 (1 revision) (flutter/flutter#180388) 2025-12-30 [email protected] Roll Skia from 27b587c4b160 to 4c438e0537fc (1 revision) (flutter/flutter#180384) 2025-12-30 [email protected] Roll Fuchsia Linux SDK from DdllqZRZYriOd7Q8v... to t1eBl_kzKGV5K28OU... (flutter/flutter#180378) 2025-12-30 [email protected] Roll Skia from 11690456a90d to 27b587c4b160 (1 revision) (flutter/flutter#180377) 2025-12-30 [email protected] Allow setting vector uniforms by name. (flutter/flutter#179927) 2025-12-30 [email protected] Roll Skia from 7abf754bce14 to 11690456a90d (6 revisions) (flutter/flutter#180374) 2025-12-29 [email protected] Add support for Shift-Delete, Ctrl-Insert and Shift-Insert (flutter/flutter#178561) 2025-12-29 [email protected] Roll Skia from c85d3e2b12d7 to 7abf754bce14 (1 revision) (flutter/flutter#180371) 2025-12-29 [email protected] Roll Packages from 2164da9 to b3c3ca8 (2 revisions) (flutter/flutter#180365) 2025-12-29 [email protected] Roll Skia from c29a475066f5 to c85d3e2b12d7 (1 revision) (flutter/flutter#180363) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 ...

This PR adds
SingleActivatormappings for IBM CUA style clipboard accessors, with which Shift-Delete, Ctrl-Insert and Shift-Insert are equivalent to ^X ^C ^V. These mappings are natively supported on Windows and Linux (but not OS X).Not sure what to do about:Documentation: Are ^X ^C ^V already documented?Tests: Are there existing tests for ^X ^C ^V already? Is it possible to mock out the clipboard so that a test of this functionality doesn't hit the actual system clipboard?OS X: Is it a problem that, with this change, Flutter will accept these additional shortcuts even though they aren't a part of the platform paradigm?UPDATE:
I'm not aware of existing documentation of clipboard shortcuts.
I have added tests, both of the existing ^X ^C ^V and of the IBM CUA style mappings added by this PR, and in the current iteration the changes do not add IBM CUA style mappings on OS X.
Fixes: #178483
Pre-launch Checklist
///).