positron icon indicating copy to clipboard operation
positron copied to clipboard

Cancel multiline input with `Esc` at console

Open FinYang opened this issue 1 year ago • 1 comments

Multiline input at the console cannot be cancelled with Esc but only ctrl+c:

Kapture 2024-08-23 at 02 33 10

I realise this design was decided at #2905. The discussion there noted people might be asking in the future, and this seems about the time people start asking ;)

There might be three things here (where 2 and 3 might be the same technically?):

  1. Use Esc to clear a one-line input.
  2. Use Esc to interrupt a process.
  3. Use Esc to exit a multiline input.

For 1, I agree with the original discussion that there are better ways like select all and delete.

What I really want to use Esc for are 2 and 3.

For 2, once I start a process I would be unlikely to type anything in the console anymore to avoid cancelling anything (unless I do want to cancel the process). A muscle memory even from RStudio. If I am going to type something it will be in a script. The rare cases where I do type something in the console are when the process is fast so the risk is small. However I do see how this is still debatable.

For 3, I don't usually type anything across multiple lines in the console intentionally. Most often it is because I am missing a closing bracket somewhere and the console starts to wait for me to close it. And it is in this case that I use Esc most often. It is just natural to reach Esc when the console hangs. It would take me some while to adjust if this feature is gone forever.

I understand the intention is to make Esc a safe key to close pop-ups with completions, etc, but that seems like a separate issue to me. That issue is about completions popping up too often/inappropriately, so, in my opinion, the solution should be adjusting the behaviour of completions, and shouldn't be sacrificing Esc. It is still a big issue to me that I am closing autocompletion more often than I actually adopt the completion, and this is not solved by just having a safe key. (I have my share of complaints about autocompletions in #4442.)

I think it would be great if we could have the option to choose if Esc behave the same way as

  1. Esc in RStudio, or
  2. current ctrl+c in Positron.

FinYang avatar Aug 22 '24 17:08 FinYang

I think the current behaviour is the right default but I agree it would be nice to make it optional. Ultimately we should make all console shortcuts regular positron keybindings on a context key (as opposed to input handlers on web components) so that users can redefine Esc and other keys to the behaviour they wish.

lionel- avatar Aug 22 '24 17:08 lionel-

Multiline input at the console cannot be cancelled with Esc but only ctrl+c:

Kapture 2024-08-23 at 02 33 10

I realise this design was decided at #2905. The discussion there noted people might be asking in the future, and this seems about the time people start asking ;)

There might be three things here (where 2 and 3 might be the same technically?):

  1. Use Esc to clear a one-line input.
  2. Use Esc to interrupt a process.
  3. Use Esc to exit a multiline input.

For 1, I agree with the original discussion that there are better ways like select all and delete.

What I really want to use Esc for are 2 and 3.

For 2, once I start a process I would be unlikely to type anything in the console anymore to avoid cancelling anything (unless I do want to cancel the process). A muscle memory even from RStudio. If I am going to type something it will be in a script. The rare cases where I do type something in the console are when the process is fast so the risk is small. However I do see how this is still debatable.

For 3, I don't usually type anything across multiple lines in the console intentionally. Most often it is because I am missing a closing bracket somewhere and the console starts to wait for me to close it. And it is in this case that I use Esc most often. It is just natural to reach Esc when the console hangs. It would take me some while to adjust if this feature is gone forever.

I understand the intention is to make Esc a safe key to close pop-ups with completions, etc, but that seems like a separate issue to me. That issue is about completions popping up too often/inappropriately, so, in my opinion, the solution should be adjusting the behaviour of completions, and shouldn't be sacrificing Esc. It is still a big issue to me that I am closing autocompletion more often than I actually adopt the completion, and this is not solved by just having a safe key. (I have my share of complaints about autocompletions in #4442.)

I think it would be great if we could have the option to choose if Esc behave the same way as

  1. Esc in RStudio, or
  2. current ctrl+c in Positron.

Please, do not forget this request.

LuisLauM avatar Jul 14 '25 14:07 LuisLauM