-
Notifications
You must be signed in to change notification settings - Fork 282
fixes crash when editing input fields #8
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
fixes crash when editing input fields #8
Conversation
- prefix text input methods uniformly. - use a switch statement for selecting method behaviour. - fix crashes in text input by properly setting initial position of the cursor.
@@ -15,9 +15,9 @@ const ( | |||
TextUpdateStateMethod = "TextInputClient.updateEditingState" | |||
|
|||
// text | |||
SetClientMethod = "TextInput.setClient" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should add a updateState method to textModel and handle all these methods in there.
} | ||
|
||
if message.Method == flutter.SetClientMethod { | ||
case flutter.TextInputClientSet: | ||
var body []interface{} | ||
json.Unmarshal(message.Args, &body) | ||
state.clientID = body[0].(float64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
facepalm why couldn't they just include the ID in the initial structure? lol
} | ||
|
||
if message.Method == flutter.SetEditingStateMethod { | ||
case flutter.TextInputSetEditState: | ||
if state.clientID != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure this check is strictly necessary. but left it in anyways.
It does fix #6 👍 |
…ial-position fixes crash when editing input fields Former-commit-id: b6345d2
position of the cursor.
may fix #6, I didn't notice any issues with multiple text inputs. however I did notice issues when hitting backspace or inserting text. backspace would crash, and text inserts would be in the incorrect position.