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

Add restart hotkey #620

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

s-redko
Copy link

@s-redko s-redko commented Nov 12, 2023

It's useful to be able to restart debugging session quickly without using q command and selecting <Restart> from the UI.
It also remove the need to have Prompt before quitting enabled so pudb can be closed faster as well.

@inducer
Copy link
Owner

inducer commented Nov 12, 2023

How about adding an "r" binding in the quit dialog, here:

("q", "quit"),

Then you could hit "qr" in quick succession and get the same result?

@s-redko
Copy link
Author

s-redko commented Nov 12, 2023

How about adding an "r" binding in the quit dialog, here:

I didn't know about that. However it still two keystrokes instead of just one.
I'll try to explain my motivation in more details.
When I try to find out where the error is coming from it usually requires multiple restarts while playing around with breakpoints. So it is very convenient to have single hotkey restart option.
Once bug is identified and I'm trying to fix it or add more debugging code I'm also following edit -> restart -> edit cycle.
Lastly it's very handy to be able to just hit q and close pudb immediately (Prompt before exit disabled)

I've happy to change r hotkey to something else. I just felt natural to use r for restart. Especially since r and f trigger the same action.

I also would like to add code switch focus to the code window inside restart function. I found that I usually call it from Breakpoints window and then have to switch to Code window. to hit c.

I do understand that it's just my workflow and might not apply for the majority of the users so I follow your suggestions.
Cheers

@asmeurer
Copy link
Collaborator

asmeurer commented Feb 9, 2024

I like the qr idea. I'm a little hesitant to mapping a single key to restart because it would be too easy to press accidentally. Unless of course it pops up a confirmation dialog, but that sort of defeats the purpose and would be no different from qr.

@asmeurer
Copy link
Collaborator

asmeurer commented Feb 9, 2024

By the way, we should indicate the Q in "quit" is a shortcut in the same way we do for the "variables" and "breakpoints" headers.

@s-redko
Copy link
Author

s-redko commented Feb 9, 2024

Should I revert my changes and add mapping of r shortcut to quit dialog box in thin PR? Or should I close this one and create a new one?

@inducer
Copy link
Owner

inducer commented Mar 22, 2024

You can just push to this branch.

@s-redko
Copy link
Author

s-redko commented Mar 26, 2024

Done. I've been using it for a while now locally. I'm happy with this solution.

@@ -196,6 +196,7 @@ def runscript(mainpyfile, args=None, pre_run="", steal_output=False,
extra_bindings=[
("q", "quit"),
("esc", "examine"),
("r", "restart"),
Copy link
Owner

Choose a reason for hiding this comment

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

Please add "r" to the text in the text box, to document the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants