Parameter input: change text modification logic#142
Conversation
|
|
||
|
|
||
| func _on_line_edit_text_changed(new_text): | ||
| func _on_line_edit_text_submitted(new_text): |
There was a problem hiding this comment.
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.
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
dylanmccall
left a comment
There was a problem hiding this comment.
This is working well for me now.
|
@dbnicholson do you think this is good for merging now? |
dbnicholson
left a comment
There was a problem hiding this comment.
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