-
Notifications
You must be signed in to change notification settings - Fork 28.7k
Page Up / Page Down in text fields #107602
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
Merged
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
9cd7960
Initial implementation
tgucio e45b2fb
Update comments
tgucio 79162a1
Document public method
tgucio 75474d2
Use const intents
tgucio 2b16700
Remove macOS page up/down shortcuts
tgucio 61d73c5
Add shortcuts tests
tgucio 474ac7d
Add page down/up in EditableText editing test
tgucio af34a0f
Exclude Cupertino platforms from tests
tgucio 0b77999
Update AUTHORS
tgucio 533cdd3
Merge branch 'master' into page-up-down-v2
tgucio aae50b3
Add _webDisablingTextShortcuts shortcuts
tgucio 4a2716b
Enable caret move with Alt+PageUp/Down on Cupertino platforms
tgucio 688e98c
Fix tests
tgucio 22ee45f
Merge branch 'flutter:master' into page-up-down-v2
tgucio 60845ab
Merge branch 'flutter:master' into page-up-down-v2
tgucio 9bc01b7
Merge branch 'flutter:master' into page-up-down-v2
tgucio 14d9b78
Fix macOS test
tgucio b49ca21
Really fix this test
tgucio ce80c8b
Fix the fix
tgucio ca70cde
Fix the comment too
tgucio 489b4c4
Enable regular page down/up on iOS
tgucio 45d1456
Update macOS intents
tgucio 2d36a0f
Fix test (again!)
tgucio 2fe0e12
Lints
tgucio 682594e
Merge branch 'master' into page-up-down-v2
tgucio 3f11297
Merge branch 'flutter:master' into page-up-down-v2
tgucio 55a6a41
Remove unnecessary consts
tgucio 8412c39
Update default_text_editing_shortcuts.dart
tgucio d70df72
Exclude iOS from test
tgucio c2a0fd0
No page down/up on iOS
tgucio 1b5a4a9
Merge branch 'flutter:master' into page-up-down-v2
tgucio 061f1fe
Remove Page Down / Up shortcut for iOS
tgucio d1b772b
Fix macOS/iOS page up/down shortcut removal
tgucio 31c7077
Trailing spaces
tgucio a12b336
Merge branch 'master' into page-up-down-v2
tgucio f5caa07
Merge branch 'flutter:master' into page-up-down-v2
tgucio 351c43f
Merge branch 'flutter:master' into page-up-down-v2
tgucio df23f65
Merge branch 'flutter:master' into page-up-down-v2
tgucio 1fcb315
Fix missing colon in selector name
tgucio c8c8467
Nits in comments
tgucio a428226
Add missing call to _adjacentPageAction.stop...RunIfSelectionChanges()
tgucio b1295f4
Remove perentheses in ternary
tgucio 07183bd
Merge line and page actions
tgucio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,3 +98,4 @@ Elsabe Ros <[email protected]> | |
Nguyễn Phúc Lợi <[email protected]> | ||
Jingyi Chen <[email protected]> | ||
Junhua Lin <[email protected]> | ||
Tomasz Gucio <[email protected]> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,13 +171,13 @@ class DefaultTextEditingShortcuts extends StatelessWidget { | |
SingleActivator(LogicalKeyboardKey.delete, alt: true, shift: pressShift): const DeleteToLineBreakIntent(forward: true), | ||
}, | ||
|
||
// Arrow: Move Selection. | ||
// Arrow: Move selection. | ||
const SingleActivator(LogicalKeyboardKey.arrowLeft): const ExtendSelectionByCharacterIntent(forward: false, collapseSelection: true), | ||
const SingleActivator(LogicalKeyboardKey.arrowRight): const ExtendSelectionByCharacterIntent(forward: true, collapseSelection: true), | ||
const SingleActivator(LogicalKeyboardKey.arrowUp): const ExtendSelectionVerticallyToAdjacentLineIntent(forward: false, collapseSelection: true), | ||
const SingleActivator(LogicalKeyboardKey.arrowDown): const ExtendSelectionVerticallyToAdjacentLineIntent(forward: true, collapseSelection: true), | ||
|
||
// Shift + Arrow: Extend Selection. | ||
// Shift + Arrow: Extend selection. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
const SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true): const ExtendSelectionByCharacterIntent(forward: false, collapseSelection: false), | ||
const SingleActivator(LogicalKeyboardKey.arrowRight, shift: true): const ExtendSelectionByCharacterIntent(forward: true, collapseSelection: false), | ||
const SingleActivator(LogicalKeyboardKey.arrowUp, shift: true): const ExtendSelectionVerticallyToAdjacentLineIntent(forward: false, collapseSelection: false), | ||
|
@@ -199,6 +199,14 @@ class DefaultTextEditingShortcuts extends StatelessWidget { | |
const SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, control: true): const ExtendSelectionToNextWordBoundaryIntent(forward: false, collapseSelection: false), | ||
const SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, control: true): const ExtendSelectionToNextWordBoundaryIntent(forward: true, collapseSelection: false), | ||
|
||
// Page Up / Down: Move selection by page. | ||
const SingleActivator(LogicalKeyboardKey.pageUp): const ExtendSelectionVerticallyToAdjacentPageIntent(forward: false, collapseSelection: true), | ||
const SingleActivator(LogicalKeyboardKey.pageDown): const ExtendSelectionVerticallyToAdjacentPageIntent(forward: true, collapseSelection: true), | ||
|
||
// Shift + Page Up / Down: Extend selection by page. | ||
const SingleActivator(LogicalKeyboardKey.pageUp, shift: true): const ExtendSelectionVerticallyToAdjacentPageIntent(forward: false, collapseSelection: false), | ||
const SingleActivator(LogicalKeyboardKey.pageDown, shift: true): const ExtendSelectionVerticallyToAdjacentPageIntent(forward: true, collapseSelection: false), | ||
|
||
const SingleActivator(LogicalKeyboardKey.keyX, control: true): const CopySelectionTextIntent.cut(SelectionChangedCause.keyboard), | ||
const SingleActivator(LogicalKeyboardKey.keyC, control: true): CopySelectionTextIntent.copy, | ||
const SingleActivator(LogicalKeyboardKey.keyV, control: true): const PasteTextIntent(SelectionChangedCause.keyboard), | ||
|
@@ -258,10 +266,7 @@ class DefaultTextEditingShortcuts extends StatelessWidget { | |
// macOS document shortcuts: https://support.apple.com/en-us/HT201236. | ||
// The macOS shortcuts uses different word/line modifiers than most other | ||
// platforms. | ||
static final Map<ShortcutActivator, Intent> _macShortcuts = _iOSShortcuts; | ||
|
||
// There is no complete documentation of iOS shortcuts. | ||
static final Map<ShortcutActivator, Intent> _iOSShortcuts = <ShortcutActivator, Intent>{ | ||
static final Map<ShortcutActivator, Intent> _macShortcuts = <ShortcutActivator, Intent>{ | ||
for (final bool pressShift in const <bool>[true, false]) | ||
...<SingleActivator, Intent>{ | ||
SingleActivator(LogicalKeyboardKey.backspace, shift: pressShift): const DeleteCharacterIntent(forward: false), | ||
|
@@ -277,7 +282,7 @@ class DefaultTextEditingShortcuts extends StatelessWidget { | |
const SingleActivator(LogicalKeyboardKey.arrowUp): const ExtendSelectionVerticallyToAdjacentLineIntent(forward: false, collapseSelection: true), | ||
const SingleActivator(LogicalKeyboardKey.arrowDown): const ExtendSelectionVerticallyToAdjacentLineIntent(forward: true, collapseSelection: true), | ||
|
||
// Shift + Arrow: Extend Selection. | ||
// Shift + Arrow: Extend selection. | ||
const SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true): const ExtendSelectionByCharacterIntent(forward: false, collapseSelection: false), | ||
const SingleActivator(LogicalKeyboardKey.arrowRight, shift: true): const ExtendSelectionByCharacterIntent(forward: true, collapseSelection: false), | ||
const SingleActivator(LogicalKeyboardKey.arrowUp, shift: true): const ExtendSelectionVerticallyToAdjacentLineIntent(forward: false, collapseSelection: false), | ||
|
@@ -310,6 +315,9 @@ class DefaultTextEditingShortcuts extends StatelessWidget { | |
const SingleActivator(LogicalKeyboardKey.home, shift: true): const ExpandSelectionToDocumentBoundaryIntent(forward: false), | ||
const SingleActivator(LogicalKeyboardKey.end, shift: true): const ExpandSelectionToDocumentBoundaryIntent(forward: true), | ||
|
||
const SingleActivator(LogicalKeyboardKey.pageUp, shift: true): const ExtendSelectionVerticallyToAdjacentPageIntent(forward: false, collapseSelection: false), | ||
const SingleActivator(LogicalKeyboardKey.pageDown, shift: true): const ExtendSelectionVerticallyToAdjacentPageIntent(forward: true, collapseSelection: false), | ||
|
||
const SingleActivator(LogicalKeyboardKey.keyX, meta: true): const CopySelectionTextIntent.cut(SelectionChangedCause.keyboard), | ||
const SingleActivator(LogicalKeyboardKey.keyC, meta: true): CopySelectionTextIntent.copy, | ||
const SingleActivator(LogicalKeyboardKey.keyV, meta: true): const PasteTextIntent(SelectionChangedCause.keyboard), | ||
|
@@ -335,6 +343,8 @@ class DefaultTextEditingShortcuts extends StatelessWidget { | |
// * Control + shift? + Z | ||
}; | ||
|
||
// There is no complete documentation of iOS shortcuts: use macOS ones. | ||
static final Map<ShortcutActivator, Intent> _iOSShortcuts = _macShortcuts; | ||
|
||
// The following key combinations have no effect on text editing on this | ||
// platform: | ||
|
@@ -350,6 +360,8 @@ class DefaultTextEditingShortcuts extends StatelessWidget { | |
// * Meta + backspace | ||
static final Map<ShortcutActivator, Intent> _windowsShortcuts = <ShortcutActivator, Intent>{ | ||
..._commonShortcuts, | ||
const SingleActivator(LogicalKeyboardKey.pageUp): const ExtendSelectionVerticallyToAdjacentPageIntent(forward: false, collapseSelection: true), | ||
const SingleActivator(LogicalKeyboardKey.pageDown): const ExtendSelectionVerticallyToAdjacentPageIntent(forward: true, collapseSelection: true), | ||
const SingleActivator(LogicalKeyboardKey.home): const ExtendSelectionToLineBreakIntent(forward: false, collapseSelection: true, continuesAtWrap: true), | ||
const SingleActivator(LogicalKeyboardKey.end): const ExtendSelectionToLineBreakIntent(forward: true, collapseSelection: true, continuesAtWrap: true), | ||
const SingleActivator(LogicalKeyboardKey.home, shift: true): const ExtendSelectionToLineBreakIntent(forward: false, collapseSelection: false, continuesAtWrap: true), | ||
|
@@ -385,7 +397,6 @@ class DefaultTextEditingShortcuts extends StatelessWidget { | |
const SingleActivator(LogicalKeyboardKey.keyA, meta: true): const DoNothingAndStopPropagationTextIntent(), | ||
}; | ||
|
||
|
||
static const Map<ShortcutActivator, Intent> _commonDisablingTextShortcuts = <ShortcutActivator, Intent>{ | ||
SingleActivator(LogicalKeyboardKey.arrowDown, alt: true): DoNothingAndStopPropagationTextIntent(), | ||
SingleActivator(LogicalKeyboardKey.arrowLeft, alt: true): DoNothingAndStopPropagationTextIntent(), | ||
|
@@ -407,6 +418,8 @@ class DefaultTextEditingShortcuts extends StatelessWidget { | |
SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true): DoNothingAndStopPropagationTextIntent(), | ||
SingleActivator(LogicalKeyboardKey.arrowRight, shift: true): DoNothingAndStopPropagationTextIntent(), | ||
SingleActivator(LogicalKeyboardKey.arrowUp, shift: true): DoNothingAndStopPropagationTextIntent(), | ||
SingleActivator(LogicalKeyboardKey.pageUp, shift: true): DoNothingAndStopPropagationTextIntent(), | ||
SingleActivator(LogicalKeyboardKey.pageDown, shift: true): DoNothingAndStopPropagationTextIntent(), | ||
SingleActivator(LogicalKeyboardKey.end, shift: true): DoNothingAndStopPropagationTextIntent(), | ||
SingleActivator(LogicalKeyboardKey.home, shift: true): DoNothingAndStopPropagationTextIntent(), | ||
SingleActivator(LogicalKeyboardKey.arrowDown): DoNothingAndStopPropagationTextIntent(), | ||
|
@@ -417,6 +430,8 @@ class DefaultTextEditingShortcuts extends StatelessWidget { | |
SingleActivator(LogicalKeyboardKey.arrowRight, control: true): DoNothingAndStopPropagationTextIntent(), | ||
SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, control: true): DoNothingAndStopPropagationTextIntent(), | ||
SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, control: true): DoNothingAndStopPropagationTextIntent(), | ||
SingleActivator(LogicalKeyboardKey.pageUp): DoNothingAndStopPropagationTextIntent(), | ||
SingleActivator(LogicalKeyboardKey.pageDown): DoNothingAndStopPropagationTextIntent(), | ||
SingleActivator(LogicalKeyboardKey.end): DoNothingAndStopPropagationTextIntent(), | ||
SingleActivator(LogicalKeyboardKey.home): DoNothingAndStopPropagationTextIntent(), | ||
SingleActivator(LogicalKeyboardKey.end, control: true): DoNothingAndStopPropagationTextIntent(), | ||
|
@@ -545,8 +560,8 @@ Intent? intentForMacOSSelector(String selectorName) { | |
// TODO(knopp): Page Up/Down intents are missing (https://github.com/flutter/flutter/pull/105497) | ||
'scrollPageUp:': ScrollToDocumentBoundaryIntent(forward: false), | ||
'scrollPageDown:': ScrollToDocumentBoundaryIntent(forward: true), | ||
'pageUpAndModifySelection': ExpandSelectionToDocumentBoundaryIntent(forward: false), | ||
'pageDownAndModifySelection:': ExpandSelectionToDocumentBoundaryIntent(forward: true), | ||
'pageUpAndModifySelection:': ExtendSelectionVerticallyToAdjacentPageIntent(forward: false, collapseSelection: false), | ||
'pageDownAndModifySelection:': ExtendSelectionVerticallyToAdjacentPageIntent(forward: true, collapseSelection: false), | ||
|
||
// Escape key when there's no IME selection popup. | ||
'cancelOperation:': DismissIntent(), | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.