Revert "Fix handling backspace on macos with text selection (#49760)" (#51577)

This reverts commit 9375377fa99e8faae8a573e9fe92b8712d33e82d.

Fixes #51511
This commit is contained in:
stuartmorgan 2020-02-28 14:28:34 -08:00 committed by GitHub
parent 9b4159c5ee
commit 6a337a76dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 52 deletions

View File

@ -437,17 +437,12 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
LogicalKeyboardKey.arrowDown,
};
static final Set<LogicalKeyboardKey> _deleteKeys = <LogicalKeyboardKey>{
LogicalKeyboardKey.delete,
LogicalKeyboardKey.backspace,
};
static final Set<LogicalKeyboardKey> _shortcutKeys = <LogicalKeyboardKey>{
LogicalKeyboardKey.keyA,
LogicalKeyboardKey.keyC,
LogicalKeyboardKey.keyV,
LogicalKeyboardKey.keyX,
..._deleteKeys,
LogicalKeyboardKey.delete,
};
static final Set<LogicalKeyboardKey> _nonModifierKeys = <LogicalKeyboardKey>{
@ -502,7 +497,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
// _handleShortcuts depends on being started in the same stack invocation
// as the _handleKeyEvent method
_handleShortcuts(key);
} else if (_deleteKeys.contains(key)) {
} else if (key == LogicalKeyboardKey.delete) {
_handleDelete();
}
}

View File

@ -3741,51 +3741,6 @@ void main() {
reason: 'on $platform',
);
expect(controller.text, isEmpty, reason: 'on $platform');
/// Paste and Select All
await sendKeys(
tester,
<LogicalKeyboardKey>[
LogicalKeyboardKey.keyV,
LogicalKeyboardKey.keyA,
],
shortcutModifier: true,
platform: platform,
);
expect(
selection,
equals(
const TextSelection(
baseOffset: 0,
extentOffset: testText.length,
affinity: TextAffinity.downstream,
),
),
reason: 'on $platform',
);
expect(controller.text, equals(testText), reason: 'on $platform');
// Backspace
await sendKeys(
tester,
<LogicalKeyboardKey>[
LogicalKeyboardKey.delete,
],
platform: platform,
);
expect(
selection,
equals(
const TextSelection(
baseOffset: 0,
extentOffset: 72,
affinity: TextAffinity.downstream,
),
),
reason: 'on $platform',
);
expect(controller.text, isEmpty, reason: 'on $platform');
}
testWidgets('keyboard text selection works as expected on linux', (WidgetTester tester) async {