posit-dev / posit-dev/positron

Cancel multiline input with `Esc` at console

Open
#4,447 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: console enhancement support
Dominant language
TypeScript
Stars
4.3k
Forks
184
Avg merge
1d 11h
Merged PRs (30d)
206

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading issue #2905 and compare its decision with the three Esc behaviors described here. Reproduce the current multiline-console behavior, then determine which cancellation behavior is intended and verify that Esc still handles completion pop-ups appropriately; done means the chosen behavior works without regressing those interactions.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.