Commit 58df220e authored by Kris Giesing's avatar Kris Giesing

Fix issue with forward-delete in editable text widget

parent fc5832dc
......@@ -52,7 +52,7 @@ class EditableString implements KeyboardClient {
}
String textAfter(TextRange range) {
return text.substring(range.end);
return text.substring(range.end, text.length);
}
String textInside(TextRange range) {
......@@ -105,8 +105,9 @@ class EditableString implements KeyboardClient {
void deleteSurroundingText(int beforeLength, int afterLength) {
TextRange beforeRange = new TextRange(
start: selection.start - beforeLength, end: selection.start);
int afterRangeEnd = math.min(selection.end + afterLength, text.length);
TextRange afterRange =
new TextRange(start: selection.end, end: selection.end + afterLength);
new TextRange(start: selection.end, end: afterRangeEnd);
_delete(afterRange);
_delete(beforeRange);
selection = new TextRange(
......
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