Skip to content
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

CodeWidget : Dispose of completion menu on activatedSignal #5910

Conversation

murraystevenson
Copy link
Contributor

This fixes the "Ctrl+Return doesn't always commit my changes when editing set expressions in the Render Pass Editor" issue reported recently. If the completion menu was visible while Ctrl+Return was pressed, changes would not be committed due to the loss of focus workaround in CodeWidget._emitEditingFinished(). Or in the case of a widget in a PlugPopup, the changes would not be committed and the PlugPopup would dismiss...

This was particularly apparent in scenes containing overlapping set names such as "LGT" and "LGT:ALL", and entering the shorter "LGT" set into a SetExpressionPlugValueWidget in a PlugPopup. Typing "LGT" would leave the completion menu up for "LGT:ALL", and then pressing Ctrl+Return would dismiss the PlugPopup without committing the change while often leaving the completion menu still visible afterwards.

@murraystevenson murraystevenson self-assigned this Jun 19, 2024
@johnhaddon johnhaddon added the core Issues with core Gaffer functionality label Jun 19, 2024
Copy link
Member

@johnhaddon johnhaddon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Murray - excellent catch!

Feels like this could all be a bit cleaner if I'd put the completer into MultiLineTextWidget instead of CodeWidget, but given where we are this seems like the most minimal fix available. The only weakness would seem to be if someone used activatedSignal().connectFront() to prevent our __activated method from being called, but I think that's probably unlikely enough for now?

Looks like we just need the obligatory Changes.md rebase before merging.

This fixes the "`Ctrl`+`Return` doesn't always commit my changes" issue reported recently. If the completion menu was visible while `Ctrl`+`Return` was pressed changes would not be committed due to the loss of focus workaround in `CodeWidget._emitEditingFinished()`. Or in the case of a widget in a PlugPopup, the changes would not be committed and the popup would dismiss...

This was particularly apparent with overlapping set names such as "LGT" and "LGT:ALL" and entering the shorter "LGT" set into a SetExpressionPlugValueWidget in a PlugPopup. Typing "LGT" would leave the completion menu up for "LGT:ALL", and then pressing `Ctrl`+`Return` would dismiss the popup without committing the change while often leaving the completion menu still visible.
@murraystevenson
Copy link
Contributor Author

Feels like this could all be a bit cleaner if I'd put the completer into MultiLineTextWidget instead of CodeWidget.

I think we've now said that sentence enough times to make it an inevitability...

The only weakness would seem to be if someone used activatedSignal().connectFront()... but I think that's probably unlikely enough for now?

Yeah, that does seem fairly unlikely, though we've tempted the fates by bringing it up...

The other thought I had while investigating this was whether it would also be better for PlugPopup to dismiss based on editingFinished rather than activated? I'd expect that would make the failure case less destructive but still annoying as the presence of a completion menu would instead block the popup from closing?

@johnhaddon
Copy link
Member

whether it would also be better for PlugPopup to dismiss based on editingFinished rather than activated?

editingFinished is a much more vague signal, so i don't think it's suitable for dismissal. it still gets emitted for the loss of focus you get when popping up a (non-completer) menu for instance. or for an accidental loss of focus.

@murraystevenson
Copy link
Contributor Author

editingFinished is a much more vague signal, so i don't think it's suitable for dismissal. it still gets emitted for the loss of focus you get when popping up a (non-completer) menu for instance. or for an accidental loss of focus.

Ah, very good point! Scratch that one then...

@murraystevenson murraystevenson merged commit 71c670f into GafferHQ:1.4_maintenance Jun 19, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issues with core Gaffer functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants