Skip to content

Commit

Permalink
fix: out of text range while composing error (#979)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyungilcho authored Dec 30, 2024
1 parent 1f124c1 commit 6ce63ec
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,14 @@ extension on TextEditingValue {
TextEditingValue format() {
final text = _whitespace + this.text;
final selection = this.selection >> _len;
final composing = this.composing >> _len;

TextRange composing = this.composing >> _len;
final textLength = text.length;

// check invalid composing
if (composing.start > textLength || composing.end > textLength) {
composing = TextRange.empty;
}

return TextEditingValue(
text: text,
Expand Down

0 comments on commit 6ce63ec

Please sign in to comment.