Unverified Commit 512e090d authored by J-P Nurmi's avatar J-P Nurmi Committed by GitHub

Fix confusing typo: extent vs. extend selection (#106002)

parent a0e333bd
...@@ -1482,40 +1482,40 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin, ...@@ -1482,40 +1482,40 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
_setSelection(selection, SelectionChangedCause.keyboard); _setSelection(selection, SelectionChangedCause.keyboard);
} }
void _handleMoveCursorForwardByCharacter(bool extentSelection) { void _handleMoveCursorForwardByCharacter(bool extendSelection) {
assert(selection != null); assert(selection != null);
final int? extentOffset = _textPainter.getOffsetAfter(selection!.extentOffset); final int? extentOffset = _textPainter.getOffsetAfter(selection!.extentOffset);
if (extentOffset == null) { if (extentOffset == null) {
return; return;
} }
final int baseOffset = !extentSelection ? extentOffset : selection!.baseOffset; final int baseOffset = !extendSelection ? extentOffset : selection!.baseOffset;
_setSelection( _setSelection(
TextSelection(baseOffset: baseOffset, extentOffset: extentOffset), TextSelection(baseOffset: baseOffset, extentOffset: extentOffset),
SelectionChangedCause.keyboard, SelectionChangedCause.keyboard,
); );
} }
void _handleMoveCursorBackwardByCharacter(bool extentSelection) { void _handleMoveCursorBackwardByCharacter(bool extendSelection) {
assert(selection != null); assert(selection != null);
final int? extentOffset = _textPainter.getOffsetBefore(selection!.extentOffset); final int? extentOffset = _textPainter.getOffsetBefore(selection!.extentOffset);
if (extentOffset == null) { if (extentOffset == null) {
return; return;
} }
final int baseOffset = !extentSelection ? extentOffset : selection!.baseOffset; final int baseOffset = !extendSelection ? extentOffset : selection!.baseOffset;
_setSelection( _setSelection(
TextSelection(baseOffset: baseOffset, extentOffset: extentOffset), TextSelection(baseOffset: baseOffset, extentOffset: extentOffset),
SelectionChangedCause.keyboard, SelectionChangedCause.keyboard,
); );
} }
void _handleMoveCursorForwardByWord(bool extentSelection) { void _handleMoveCursorForwardByWord(bool extendSelection) {
assert(selection != null); assert(selection != null);
final TextRange currentWord = _textPainter.getWordBoundary(selection!.extent); final TextRange currentWord = _textPainter.getWordBoundary(selection!.extent);
final TextRange? nextWord = _getNextWord(currentWord.end); final TextRange? nextWord = _getNextWord(currentWord.end);
if (nextWord == null) { if (nextWord == null) {
return; return;
} }
final int baseOffset = extentSelection ? selection!.baseOffset : nextWord.start; final int baseOffset = extendSelection ? selection!.baseOffset : nextWord.start;
_setSelection( _setSelection(
TextSelection( TextSelection(
baseOffset: baseOffset, baseOffset: baseOffset,
...@@ -1525,14 +1525,14 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin, ...@@ -1525,14 +1525,14 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
); );
} }
void _handleMoveCursorBackwardByWord(bool extentSelection) { void _handleMoveCursorBackwardByWord(bool extendSelection) {
assert(selection != null); assert(selection != null);
final TextRange currentWord = _textPainter.getWordBoundary(selection!.extent); final TextRange currentWord = _textPainter.getWordBoundary(selection!.extent);
final TextRange? previousWord = _getPreviousWord(currentWord.start - 1); final TextRange? previousWord = _getPreviousWord(currentWord.start - 1);
if (previousWord == null) { if (previousWord == null) {
return; return;
} }
final int baseOffset = extentSelection ? selection!.baseOffset : previousWord.start; final int baseOffset = extendSelection ? selection!.baseOffset : previousWord.start;
_setSelection( _setSelection(
TextSelection( TextSelection(
baseOffset: baseOffset, baseOffset: baseOffset,
......
...@@ -3534,8 +3534,8 @@ class SemanticsConfiguration { ...@@ -3534,8 +3534,8 @@ class SemanticsConfiguration {
set onMoveCursorForwardByCharacter(MoveCursorHandler? value) { set onMoveCursorForwardByCharacter(MoveCursorHandler? value) {
assert(value != null); assert(value != null);
_addAction(SemanticsAction.moveCursorForwardByCharacter, (Object? args) { _addAction(SemanticsAction.moveCursorForwardByCharacter, (Object? args) {
final bool extentSelection = args! as bool; final bool extendSelection = args! as bool;
value!(extentSelection); value!(extendSelection);
}); });
_onMoveCursorForwardByCharacter = value; _onMoveCursorForwardByCharacter = value;
} }
...@@ -3552,8 +3552,8 @@ class SemanticsConfiguration { ...@@ -3552,8 +3552,8 @@ class SemanticsConfiguration {
set onMoveCursorBackwardByCharacter(MoveCursorHandler? value) { set onMoveCursorBackwardByCharacter(MoveCursorHandler? value) {
assert(value != null); assert(value != null);
_addAction(SemanticsAction.moveCursorBackwardByCharacter, (Object? args) { _addAction(SemanticsAction.moveCursorBackwardByCharacter, (Object? args) {
final bool extentSelection = args! as bool; final bool extendSelection = args! as bool;
value!(extentSelection); value!(extendSelection);
}); });
_onMoveCursorBackwardByCharacter = value; _onMoveCursorBackwardByCharacter = value;
} }
...@@ -3570,8 +3570,8 @@ class SemanticsConfiguration { ...@@ -3570,8 +3570,8 @@ class SemanticsConfiguration {
set onMoveCursorForwardByWord(MoveCursorHandler? value) { set onMoveCursorForwardByWord(MoveCursorHandler? value) {
assert(value != null); assert(value != null);
_addAction(SemanticsAction.moveCursorForwardByWord, (Object? args) { _addAction(SemanticsAction.moveCursorForwardByWord, (Object? args) {
final bool extentSelection = args! as bool; final bool extendSelection = args! as bool;
value!(extentSelection); value!(extendSelection);
}); });
_onMoveCursorForwardByCharacter = value; _onMoveCursorForwardByCharacter = value;
} }
...@@ -3588,8 +3588,8 @@ class SemanticsConfiguration { ...@@ -3588,8 +3588,8 @@ class SemanticsConfiguration {
set onMoveCursorBackwardByWord(MoveCursorHandler? value) { set onMoveCursorBackwardByWord(MoveCursorHandler? value) {
assert(value != null); assert(value != null);
_addAction(SemanticsAction.moveCursorBackwardByWord, (Object? args) { _addAction(SemanticsAction.moveCursorBackwardByWord, (Object? args) {
final bool extentSelection = args! as bool; final bool extendSelection = args! as bool;
value!(extentSelection); value!(extendSelection);
}); });
_onMoveCursorBackwardByCharacter = value; _onMoveCursorBackwardByCharacter = value;
} }
......
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