Skip to content

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

Merged
merged 1 commit into from
Sep 13, 2018
Merged

fixes crash when editing input fields #8

merged 1 commit into from
Sep 13, 2018

Conversation

james-lawrence
Copy link
Contributor

  • 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.

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.

- 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"
Copy link
Contributor Author

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)
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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.

@pchampio
Copy link
Member

It does fix #6 👍

@pchampio pchampio merged commit b6345d2 into go-flutter-desktop:master Sep 13, 2018
pchampio pushed a commit that referenced this pull request Sep 13, 2018
…ial-position

fixes crash when editing input fields

Former-commit-id: b6345d2
@james-lawrence james-lawrence deleted the textModel/properly-set-initial-position branch September 13, 2018 21:41
@winner484 winner484 mentioned this pull request Mar 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Multiple TextField support
2 participants