Bug 573303 - [CDT] No keyboard shortcut for program termination in Run mode in C/C++ Perspective
Summary: [CDT] No keyboard shortcut for program termination in Run mode in C/C++ Persp...
Status: RESOLVED WORKSFORME
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 10.2.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: cdt-debug-inbox@eclipse.org CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-02 02:42 EDT by Jarek Blakarz CLA
Modified: 2022-04-03 06:02 EDT (History)
2 users (show)

See Also:


Attachments
Jarek's program terminate Eclipse CDT key bindings (91.08 KB, image/png)
2022-04-03 05:59 EDT, Jarek Blakarz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jarek Blakarz CLA 2021-05-02 02:42:09 EDT
There is no keyboard shortcut for program termination in Run mode in C/C++ Perspective.
Clicking red square in the UI works perfectly but the shortcut would be extremely helpful.
I've tried CTRL+F2 or SHIFT+F11 but none of them works.
Please consider fixing/implementing it.

Eclipse IDE for C/C++ Developers (includes Incubating components)
Version: 2021-03 (4.19.0)
Build id: 20210312-0638

Thank you
Comment 1 Jonah Graham CLA 2021-05-15 20:34:56 EDT
As reported in Comment 0 - Ctrl-F2 keyboard shortcut does not work. I reproduced by creating trivial Hello World Java program in Eclipse SDK 4.20 M2, putting in a breakpoint and when stopped on that breakpoint the Ctrl-F2 has no effect.

Therefore as this is not a CDT only problem, I am transferring to the Eclipse Platform Debug team.


Hi Jarek, thank you for the bug report. Normally I would have said if you want to expand the scope of the keyboard shortcut you go to Preferences -> General -> Keys -> type "terminate" and then change then "when" field to something wider, such as "In Windows" or "Editing Text" as you saw fit. However as you can see above there is a more fundamental problem specifically about terminating shortcut that needs resolving too.
Comment 2 Jonah Graham CLA 2021-05-15 20:39:47 EDT
I tried in the oldest Eclipse SDK I had lying around (3.8.2) and it doesn't work there either. Starting to look like this particular keyboard shortcut has not worked in a very long time, if at all - at least on Linux in case it is an OS issue.
Comment 3 Jonah Graham CLA 2021-05-15 20:52:48 EDT
Ahh - of course. Ctrl-F2 (at least on my Xubuntu machine) is set to switch to Workspace 2. As I only have 1 workspace it simply did not look like it worked at all. @Platform.Debug Sorry for the noise.
Comment 4 Jonah Graham CLA 2021-05-15 20:58:59 EDT
@Jarek - now that I have "unconfused" myself the comment I made in Comment 1 stands. If Ctrl-F2 is mapped in your window manager to something else (like it was for me) you will also have to map it to something else.

If you want to expand the scope of the keyboard shortcut you go to Preferences -> General -> Keys -> type "terminate" and then change then "when" field to something wider, such as "In Windows" or "Editing Text" as you saw fit.

I found "In Windows" worked for me. However, if the running process is not selected in the Debug view (regardless of perspective) then the Terminate is disabled.
Comment 5 Jonah Graham CLA 2021-05-15 21:12:10 EDT
The instructions in Comment 1 mean that there is nothing else to do in CDT on this.

However I find that largely unsatisfying because I believe with that OP wants is a keyboard shortcut to just terminate the program - a reasonable request!

The best I can offer is to add a keyboard shortcut to "Terminate/Disconnect All" command that is currently in the Debug view's context menu. However that command does not appear in "Keys" preferences, so it is not possible to add a keyboard shortcut.

Therefore I have raised Bug 573561 with the platform team to request that be resolve and I think that is the best solution long term.

FWIW the other solutions I thought of were adding a new command to terminate the last launched program, or write some code to make the newly launched program be selected in the Debug view, but both of those were complicated and have other issues.

Thanks again for the bug report!
Comment 6 Jonah Graham CLA 2021-05-25 14:39:37 EDT
For Eclipse 2021-06 you will be able to add a key binding for Terminate All (See Bug 573561).

There is one remaining issue to make this useable, and that is to make sure Terminate All is enabled all the time, and not just when there is a selection in the Debug view. I have filed Bug 573766 for that if you are interested.
Comment 7 Jarek Blakarz CLA 2022-04-03 05:59:37 EDT
Created attachment 288365 [details]
Jarek's program terminate Eclipse CDT key bindings
Comment 8 Jarek Blakarz CLA 2022-04-03 06:02:47 EDT
I'm using CDT 10.6.0 and I'm able to add the keyboard shortcuts for "Terminate/Disconnect All" and "Terminate" with "when" set to "In Windows".
However it does not work when launching a program in "Run" mode (not "Debug" mode). I understand that it is due to Bug 573766.
The "ctrl+f2" is not defined in my Xubuntu. I've remapped the workspace keybindings to something else.

Please the the attachment https://bugs.eclipse.org/bugs/attachment.cgi?id=288365 added in Comment 7.

Thank you for your work and extensive comments.