-
Notifications
You must be signed in to change notification settings - Fork 20
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
Parameter input: change text modification logic #142
Conversation
@@ -126,10 +131,16 @@ func get_string() -> String: | |||
return "%s" % input | |||
|
|||
|
|||
func _on_line_edit_text_changed(new_text): | |||
func _on_line_edit_text_submitted(new_text): |
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.
This function is also used to handle the Vector2 input signals. You'll need to split those to a separate function (arguably they should have been already).
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.
Oh I totally missed that, good catch! PR updated. It is a bit boilerplate now. An alternative would be to connect to the callbacks in code (not in the Signals dock in the editor) and bind the corresponding LineEdit as argument. And also have a dict for the last text submitted, with each LineEdit as key.
fa535ce
to
4500268
Compare
Previously any text change was sending the modified signal, adding too many actions to the undo/redo history (one per typed character). This was also capturing shortcuts like Ctrl-Z for undoing and sending the modified signal, thus piling to the history, not going back. Instead, send the modified signal when the line edit is submitted (enter key pressed) or when it loses focus and the text has changed. Do this for the 3 line edit nodes. https://phabricator.endlessm.com/T35566
4500268
to
9f3f1a7
Compare
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.
This is working well for me now.
@dbnicholson do you think this is good for merging now? |
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.
Sorry, forgot to check back on this! Yes, it looks good now!
Previously any text change was sending the modified signal, adding too many actions to the undo/redo history (one per typed character). This was also capturing shortcuts like Ctrl-Z for undoing and sending the modified signal, thus piling to the history, not going back.
Instead, send the modified signal when the line edit is submitted (enter key pressed) or when it loses focus and the text has changed.
https://phabricator.endlessm.com/T35566