Commit 008af64c authored by Adam Barth's avatar Adam Barth

Keyboard service doesn't commit the last edit when it's dismissed

We were getting the proper values, but we thought we were still composing, so
the text was still underlined.

Fixes #115
parent 9862605f
......@@ -109,6 +109,7 @@ class _InputState extends State<Input> {
_editableString.selection.end);
} else if (!focused && _keyboardHandle.attached) {
_keyboardHandle.release();
_editableString.composing = TextRange.empty;
}
}
......
......@@ -26,10 +26,12 @@ class TextRange {
end = position;
/// A text range that contains nothing and is not in the text.
const TextRange.empty()
const TextRange._empty()
: start = -1,
end = -1;
static const TextRange empty = const TextRange._empty();
/// The index of the first character in the range.
final int start;
......@@ -56,7 +58,7 @@ class EditableString implements KeyboardClient {
String text;
// The range of text that is still being composed.
TextRange composing = const TextRange.empty();
TextRange composing = TextRange.empty;
/// The range of text that is currently selected.
TextRange selection;
......@@ -124,7 +126,7 @@ class EditableString implements KeyboardClient {
// TODO(abarth): Why is |newCursorPosition| always 1?
TextRange committedRange = _replaceOrAppend(composing, text);
selection = new TextRange.collapsed(committedRange.end);
composing = const TextRange.empty();
composing = TextRange.empty;
onUpdated();
}
......@@ -161,7 +163,7 @@ class EditableString implements KeyboardClient {
}
void submit(SubmitAction action) {
composing = const TextRange.empty();
composing = TextRange.empty;
onSubmitted();
}
}
......
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