inducer / pudb

Full-screen console debugger for Python
https://documen.tician.de/pudb/
Other
2.94k stars 226 forks source link

Add restart hotkey #620

Open s-redko opened 10 months ago

s-redko commented 10 months ago

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 commented 10 months ago

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

https://github.com/inducer/pudb/blob/8c8f9d4a25e226e77a18d4d938eecf2f969e9b32/pudb/__init__.py#L197

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

s-redko commented 10 months ago

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 commented 7 months ago

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 commented 7 months ago

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 commented 7 months ago

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 commented 5 months ago

You can just push to this branch.

s-redko commented 5 months ago

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