[FR]: Quit without dialog on Ctrl-C
https://github.com/blacknon/hwatch/issues/110 implemented a confirmation dialog on exit. I think it is nice, but I think that Ctrl-C should just exit unconditionally. It can be labeled as a separate key binding for "quit immediately".
The original plan with https://github.com/blacknon/hwatch/issues/110 seems to have been to include an option for disabling the dialog. This seems at least partially implemented, but I couldn't find the documentation.
Regardless, after a bit of thought, I think that the confirmation dialog by default is nice, since q can be hit accidentally, but having Ctrl-C override it would both be intuitive, and there wouldn't really be a need for an option if that's implemented.
I also appreciate how q q quits, nice idea! Currently, however, Ctrl-C Ctrl-C does not quit.
Another, minor, suggestion: Esc could close the dialog. Esc could also close the help dialog.
More significantly, perhaps q q should the documented. The dialog could say:
Exit hwatch?
Y, Q : Quit
N, Esc: Stay
with Y,Q,N,Esc bold or highlighted.
It could also maybe say, as a footnote, "Use Ctrl-C to skip this dialog"
That maybe. That might be more naturally.
Change the default behavior while still leaving room for customization with options.
Looking at the keybinds, I think Esc and maybe Ctrl-G (for Emacs-lovers) should be "cancel", and Ctrl-C should be "abort". I think both Esc and Ctrl-G could be called cancel dialog or filter.
Of these, I feel that having Ctrl-C as a mild "cancel" (as it is now) is quite surprising, so it should be changed IMO. The rest of my suggestions seem natural to me but are more arguable/lower priority (again, IMO of course).
this done. I think it will probably work as you comments.
Thank you very much!
What you implemented is pretty close to what I wanted, with one major difference. I would prefer it if pressing Ctrl-C once would exit hwatch, and perhaps return the SIGINT error code. Currently, if you press h, you have to then press Ctrl-C three times to quit.
However, I don't insist on making this change. While I think that would be a slight improvement, I also think things are pretty good already; they no longer feel counterintuitive and it's now easy to discover that q q quits.
What you implemented is pretty close to what I wanted, with one major difference. I would prefer it if pressing Ctrl-C once would exit hwatch, and perhaps return the SIGINT error code. Currently, if you press h, you have to then press Ctrl-C three times to quit.
How about adding a process to the keymap to handle this? 🤔
I checked, and it seems like regular watch quits with 0 error code on Ctrl-C. So, I think creating a "quit without confirmation" command and mapping Ctrl-C to it would work.
Now, let's create a key function so that we can set it up with a custom keymap. shall we manage it in a new issue.
This issue will be closed for the time being as we will take further action in #138.