-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not clear how to map some String position to the Characters position, and vice-versa. #381
Comments
I'd prefer to not expose indices in the A more indirect approach would be constructors for the To go the other way, the It's not an "index'. But it is, really. |
Also do some clean-up. Fixes #21, #22 and #24: * https://github.com/dart-lang/characters/issues/24 * https://github.com/dart-lang/characters/issues/22 * https://github.com/dart-lang/characters/issues/21
Add some extra functionality Also do some clean-up. Fixes #21, #22 and #24: * https://github.com/dart-lang/characters/issues/24 * https://github.com/dart-lang/characters/issues/22 * https://github.com/dart-lang/characters/issues/21
Some functionality added. |
Add some extra functionality Also do some clean-up. Fixes dart-lang/characters#21, dart-lang/characters#22 and dart-lang/characters#24: * https://github.com/dart-lang/characters/issues/24 * https://github.com/dart-lang/characters/issues/22 * https://github.com/dart-lang/characters/issues/21
If you have some text in a
TextField
you can get the caret's (also called cursor) position. If you want to delete the character at the caret's position, you must be able to say that, say, the 7th position in theString
maps to the 5th position in theCharacters
, so that you can delete this char.The same problem arises if you want to add some character in the caret's position.
But is there a way to do this? Doesn't seem so, or at least it's not obvious to me.
This is important, since the
TextField
will report positions in theString
, not in theCharacters
. I suggest the following to methods:If you want to be really complete, you can also have these methods:
The text was updated successfully, but these errors were encountered: