10 Commits

Author SHA1 Message Date
Chris Bracken
7e6191de07
Separate mutators for text and selection (#21612)
Previously, TextInputModel's SetEditingState method was a 1:1 mapping of
the underlying protocol used on the text input channel between the
framework and the engine. This breaks it up into two methods, which
allows the selection to be updated independently of the text, and avoids
tying the API the the underlying protocol.

This will become more important when we add additional state to support
composing regions for multi-step input methods such as those used for
Japanese.

SetText resets the selection rather than making a best-efforts attempt
to preserve it. This choice was primarily to keep the code simple and
make the API easier to reason about. An alternative would have been to
make a best-effort attempt to preserve the selection, potentially
clamping one or both to the end of the new string. In all cases where an
embedder resets the string, it is expected that they also have the
selection, so can call SetSelection with an updated selection if needed.
2020-10-06 11:07:21 -07:00
Maksim Lin
57fdf0a1fb
send newline char when input type is multiline (#20660) 2020-08-25 10:51:02 -07:00
Robert Ancell
ab23dc3a74 Update code style to pass clang-tidy checks 2020-08-05 10:35:03 +12:00
stuartmorgan
29f63349c8
Fix invalid selection handling in text plugins (#19899)
The Windows, Linux, and GLFW embeddings (which all share a common code
ancestry) pass TextInput.setEditingState selection base and extents
straight through to the shared text model class. The model expects those
values to be valid, but the framework sends -1/-1 for "invalid"
selections, which happen for some empty text cases (e.g.,
TextFieldController.clear()).

This translates those invalid selection values to an empty selection at
the start of the string, as expected by the model.

Fixes https://github.com/flutter/flutter/issues/59140
2020-07-27 11:00:02 -07:00
Robert Ancell
9f898e98c2
Don't process key events when the text input is not requested (#18990) 2020-06-12 10:59:35 +12:00
Robert Ancell
6f5d92d241
Remove the input type and action from TextInputModel. (#18919)
These aren't used by the model so are better managed outside of it.
2020-06-10 10:00:32 +12:00
Robert Ancell
db6793bca3
Use constant for error code (#18913) 2020-06-10 06:27:08 +12:00
Robert Ancell
320e80552f
Update FlTextInputPlugin method handler style. (#18886)
Match the style used in the external plugins and more carefully vet the incoming
arguments.
2020-06-09 11:36:00 +12:00
Robert Ancell
8d97830992
Fix braces style (#18837) 2020-06-05 13:26:54 +12:00
Robert Ancell
2bd95d9a4c
Add FlTextInputPlugin (#18314)
* Add FlTextInputPlugin
2020-05-28 13:11:16 +12:00