-
Notifications
You must be signed in to change notification settings - Fork 757
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
On macOS, register cmd+q on sclang interpreter main menu, solves #3824 #4533
On macOS, register cmd+q on sclang interpreter main menu, solves #3824 #4533
Conversation
thanks geoffroy! cc @redFrik |
Thank you @geoffroymontel ! I won't be able to look at this for few days but I'd love to eventually - unless others get to it first :) |
I can confirm this prevents the crash when pressing Not sure if it would be in the scope of this PR, but the SC GUI window still can't be closed with |
BTW should we write |
Thanks for reviewing !!
Mmm, it's quite different. Could you file a new issue with this feature request please ? Best |
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.
I'd like to get the ball rolling with this - I can confirm that this works as expected.
It would be great if someone else with c++ knowledge took a look at this before merging.
#4309 is already filed, is this what you had in mind? |
#4309 is already filed, is this what you had in mind?
Perfect ! Thanks for the pointer !
|
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.
I think these look good now. Thanks! However, @brianlheim - I'm not sure, but looking at the travis output it looks like something is failing in the linting? Thoughts?
Yes, it is. @geoffroymontel can you please fix that? Check the build log for the details. |
@brianlheim sorry for that, it's fixed 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.
thanks! sorry for the delay, life was busy for the last month or so.
going through 3.10.4 changes for the changelog, i'm a bit confused by this one -- if cmd+q is supposed to quit the interpreter, why is it bad that the interpreter would quit with this shortcut? is this a regression from earlier behavior somehow? |
see #3824 (comment) i'm not sure whether in the past cmd-q was supposed to quit the interpreter on macos. i think it's mainly that this can be confusing for beginners and doesn't offer much benefit for experienced users. someone else can probably answer this more fully though, i'm now also a bit confused myself. |
it also looks like the bug report in #3824 is a full-blown segmentation fault, not a graceful exit, but maybe someone could answer to what the behavior was before the crash (assuming that it was a regression). |
It is (was?) a regression. And yes, the issue was that this was a segfault instead of a graceful exit. In 3.8, when the interpreter got a separate icon, cmd-q was not triggering shutdown (no action) when interpreter was in focus. This seems to be the desired behavior. At some point this changed to segfault, which is definitely a regression. This PR restores the behavior from 3.8. For reference, in the cocoa days, and before the interpreter had a separate icon, there was no concept of shutting it off by itself. With either the editor or a gui window cmd-q would quit everything - editor, interpreter (and by extension the server). In practice, if one was in the middle of working on code with unsaved changes, any accidental cmd-q would prompt "save changes?" dialog, preventing accidental shutdown. |
thanks for the explanation. there is a lot of "convention over configuration" keybindings happening in sclang gui, which i'm not a huge fan of. what if someone isn't using the IDE, and actually does want cmd+q to quit the interpreter? |
I think supporting cmd+q to quit the interpreter causes more harm than benefits ! I don't see a practical use case for it. Removing it at least solves a few annoying bugs (like pressing cmd+q on a user Window during a performance would kill the interpreter). |
I just checked - cmd+q is propagated like any other key combination to the views in the QT GUI. So user still has the option to implement quit if desired. |
Purpose and Motivation
Fixes #3824
Like in PR #4500 the fix consists in adding an
Action
withQAction::QuitRole
so that this action registers cmd+q on macOS.I disable this menu action so that Quit menu item is greyed out in the interpreter window.
MainMenu is not affected, it still works, I checked.
Types of changes
To-do list