Unverified Commit 21158d83 authored by Greg Spencer's avatar Greg Spencer Committed by GitHub

Add command key bindings to macOS text editing and fix selection. (#44130)

This adds support for the command key for text selection/editing on macOS. I had ported the text editing code (in #42879), but forgot to add support for the command key itself. This also adds a test that tests the text editing on multiple platforms instead of just testing Android.

There appears to still be a bug (filed #44135) where we're losing key events sometimes on macOS, leaving some keys "stuck" on, but this PR at least allows the right key combinations to be used.
parent a7367b65
...@@ -816,15 +816,15 @@ class TextPainter { ...@@ -816,15 +816,15 @@ class TextPainter {
/// <http://www.unicode.org/reports/tr29/#Word_Boundaries>. /// <http://www.unicode.org/reports/tr29/#Word_Boundaries>.
TextRange getWordBoundary(TextPosition position) { TextRange getWordBoundary(TextPosition position) {
assert(!_needsLayout); assert(!_needsLayout);
// TODO(gspencergoog): remove the List<int>-based code when the engine API return _paragraph.getWordBoundary(position);
// returns a TextRange instead of a List<int>. }
final dynamic boundary = _paragraph.getWordBoundary(position);
if (boundary is List<int>) { /// Returns the text range of the line at the given offset.
final List<int> indices = boundary; ///
return TextRange(start: indices[0], end: indices[1]); /// The newline, if any, is included in the range.
} TextRange getLineBoundary(TextPosition position) {
final TextRange range = boundary; assert(!_needsLayout);
return range; return _paragraph.getLineBoundary(position);
} }
/// Returns the full list of [LineMetrics] that describe in detail the various /// Returns the full list of [LineMetrics] that describe in detail the various
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment