sharkdp / insect

High precision scientific calculator with support for physical units
https://numbat.dev/
MIT License
3.17k stars 126 forks source link

[cli] Change unconventional behavior of Ctrl-C #369

Closed triallax closed 1 year ago

triallax commented 1 year ago

In most REPL-style tools I use, Ctrl-D is the binding used to exit the program, while Ctrl-C "resets" the prompt. There is some variety with Ctrl-C's behavior if the current input is empty (on the shells that I tried, it just starts a new prompt, but with e.g. Qalculate it exits the program), yet with everything I tried, Ctrl-C starts a new, empty line if there is existing input. Insect is the only program I am aware of that flies in the face of this convention and always exits when Ctrl-C is pressed, and I think keeping it like this is a mistake.

A question arises if we decide to do this, however: when there is no input, should Ctrl-C exit Insect (like Qalculate does), or should it simply start a new line (like basically all of the shells I tried)?

Thoughts?

sharkdp commented 1 year ago

always exits when Ctrl-C is pressed, and I think keeping it like this is a mistake.

I wonder if it has always been like this, or if it was caused by the readline dependency switch. Anyway, I fully agree that this should be changed.

A question arises if we decide to do this, however: when there is no input, should Ctrl-C exit Insect (like Qalculate does), or should it simply start a new line (like basically all of the shells I tried)?

Let's go with "all the other shells"

triallax commented 1 year ago

I wonder if it has always been like this, or if it was caused by the readline dependency switch.

I'm highly leaning towards it being the earlier case, but I don't necessarily feel like checking.

Let's go with "all the other shells"

Alright then, I slightly prefer this option too.