mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix confusing typo: extent vs. extend selection (#106002)
This commit is contained in:
parent
a0e333bdc6
commit
512e090dfd
@ -1482,40 +1482,40 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
|
||||
_setSelection(selection, SelectionChangedCause.keyboard);
|
||||
}
|
||||
|
||||
void _handleMoveCursorForwardByCharacter(bool extentSelection) {
|
||||
void _handleMoveCursorForwardByCharacter(bool extendSelection) {
|
||||
assert(selection != null);
|
||||
final int? extentOffset = _textPainter.getOffsetAfter(selection!.extentOffset);
|
||||
if (extentOffset == null) {
|
||||
return;
|
||||
}
|
||||
final int baseOffset = !extentSelection ? extentOffset : selection!.baseOffset;
|
||||
final int baseOffset = !extendSelection ? extentOffset : selection!.baseOffset;
|
||||
_setSelection(
|
||||
TextSelection(baseOffset: baseOffset, extentOffset: extentOffset),
|
||||
SelectionChangedCause.keyboard,
|
||||
);
|
||||
}
|
||||
|
||||
void _handleMoveCursorBackwardByCharacter(bool extentSelection) {
|
||||
void _handleMoveCursorBackwardByCharacter(bool extendSelection) {
|
||||
assert(selection != null);
|
||||
final int? extentOffset = _textPainter.getOffsetBefore(selection!.extentOffset);
|
||||
if (extentOffset == null) {
|
||||
return;
|
||||
}
|
||||
final int baseOffset = !extentSelection ? extentOffset : selection!.baseOffset;
|
||||
final int baseOffset = !extendSelection ? extentOffset : selection!.baseOffset;
|
||||
_setSelection(
|
||||
TextSelection(baseOffset: baseOffset, extentOffset: extentOffset),
|
||||
SelectionChangedCause.keyboard,
|
||||
);
|
||||
}
|
||||
|
||||
void _handleMoveCursorForwardByWord(bool extentSelection) {
|
||||
void _handleMoveCursorForwardByWord(bool extendSelection) {
|
||||
assert(selection != null);
|
||||
final TextRange currentWord = _textPainter.getWordBoundary(selection!.extent);
|
||||
final TextRange? nextWord = _getNextWord(currentWord.end);
|
||||
if (nextWord == null) {
|
||||
return;
|
||||
}
|
||||
final int baseOffset = extentSelection ? selection!.baseOffset : nextWord.start;
|
||||
final int baseOffset = extendSelection ? selection!.baseOffset : nextWord.start;
|
||||
_setSelection(
|
||||
TextSelection(
|
||||
baseOffset: baseOffset,
|
||||
@ -1525,14 +1525,14 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
|
||||
);
|
||||
}
|
||||
|
||||
void _handleMoveCursorBackwardByWord(bool extentSelection) {
|
||||
void _handleMoveCursorBackwardByWord(bool extendSelection) {
|
||||
assert(selection != null);
|
||||
final TextRange currentWord = _textPainter.getWordBoundary(selection!.extent);
|
||||
final TextRange? previousWord = _getPreviousWord(currentWord.start - 1);
|
||||
if (previousWord == null) {
|
||||
return;
|
||||
}
|
||||
final int baseOffset = extentSelection ? selection!.baseOffset : previousWord.start;
|
||||
final int baseOffset = extendSelection ? selection!.baseOffset : previousWord.start;
|
||||
_setSelection(
|
||||
TextSelection(
|
||||
baseOffset: baseOffset,
|
||||
|
||||
@ -3534,8 +3534,8 @@ class SemanticsConfiguration {
|
||||
set onMoveCursorForwardByCharacter(MoveCursorHandler? value) {
|
||||
assert(value != null);
|
||||
_addAction(SemanticsAction.moveCursorForwardByCharacter, (Object? args) {
|
||||
final bool extentSelection = args! as bool;
|
||||
value!(extentSelection);
|
||||
final bool extendSelection = args! as bool;
|
||||
value!(extendSelection);
|
||||
});
|
||||
_onMoveCursorForwardByCharacter = value;
|
||||
}
|
||||
@ -3552,8 +3552,8 @@ class SemanticsConfiguration {
|
||||
set onMoveCursorBackwardByCharacter(MoveCursorHandler? value) {
|
||||
assert(value != null);
|
||||
_addAction(SemanticsAction.moveCursorBackwardByCharacter, (Object? args) {
|
||||
final bool extentSelection = args! as bool;
|
||||
value!(extentSelection);
|
||||
final bool extendSelection = args! as bool;
|
||||
value!(extendSelection);
|
||||
});
|
||||
_onMoveCursorBackwardByCharacter = value;
|
||||
}
|
||||
@ -3570,8 +3570,8 @@ class SemanticsConfiguration {
|
||||
set onMoveCursorForwardByWord(MoveCursorHandler? value) {
|
||||
assert(value != null);
|
||||
_addAction(SemanticsAction.moveCursorForwardByWord, (Object? args) {
|
||||
final bool extentSelection = args! as bool;
|
||||
value!(extentSelection);
|
||||
final bool extendSelection = args! as bool;
|
||||
value!(extendSelection);
|
||||
});
|
||||
_onMoveCursorForwardByCharacter = value;
|
||||
}
|
||||
@ -3588,8 +3588,8 @@ class SemanticsConfiguration {
|
||||
set onMoveCursorBackwardByWord(MoveCursorHandler? value) {
|
||||
assert(value != null);
|
||||
_addAction(SemanticsAction.moveCursorBackwardByWord, (Object? args) {
|
||||
final bool extentSelection = args! as bool;
|
||||
value!(extentSelection);
|
||||
final bool extendSelection = args! as bool;
|
||||
value!(extendSelection);
|
||||
});
|
||||
_onMoveCursorBackwardByCharacter = value;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user