Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console: should Esc cancel a continuation prompt? #5898

Open
anbrav0 opened this issue Jan 7, 2025 · 3 comments
Open

Console: should Esc cancel a continuation prompt? #5898

anbrav0 opened this issue Jan 7, 2025 · 3 comments
Labels
area: console Issues related to Console category. enhancement New feature or request support

Comments

@anbrav0
Copy link

anbrav0 commented Jan 7, 2025

System details:

Positron and OS details:

Positron Version: 2025.01.0 (Universal) build 152
Code - OSS Version: 1.95.0
Commit: 66aa3fb7f98eb8d19155cb7220856154f6ede8b3
Date: 2025-01-06T02:47:02.050Z
Electron: 32.2.1
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Darwin arm64 24.0.0

Interpreter details: R 4.4.1

Describe the issue:

In RStudios, when the interpreter detects you have possibly typed incomplete code, the console prompts you + indicating that the code execution is not complete, and to complete the code. To get out of the + when the console detects an incomplete execution, the esc key is helpful to return the console to starting prompt >. However, in Positron, pressing the esc key does not reset the console to the > prompt

Please let me know if there is already an issue, or a feature request already submitted regarding this, I apologize in advance if so, and would be happy to close this issue, in favor of one that is already being followed. :)

Steps to reproduce the issue:

  1. Open Positron and RStudio
  2. In the Positron and Rstudio console typelibrary(tidyverse)
  3. Call any function to prompt console incompletion has been detected (e.g., in Positron and RStudio console, type ggplot() +
  4. Observe Positron and RStudio console detection of incomplete execution with console prompting +
  5. try to press the esc key to reset console to > prompt
  6. Observe difference in behavior (e.g., RStudio console resets to >, while Positron console stays in the + prompt

Expected or desired behavior:

Behavior is expected to be consistent with RStudio, as in, pressing esc key should reset console prompt to >

Were there any error messages in the UI, Output panel, or Developer Tools console?

NA

@juliasilge
Copy link
Contributor

We have had previous discussions on this, such as in #5186, but maybe not an issue. To sum up, this is actually on purpose, because Escape is also used to close popups and we have found that people can not-infrequently lose code in the console that they intended to keep by mashing Escape; it's pretty destructive.

You can take a look at the linked discussion for more thoughts, but what you may be looking for is Ctrl+C. Some benefits of this one over Escape is that it is more consistent with terminals, more single purpose, and harder to do by accident.

@anbrav0
Copy link
Author

anbrav0 commented Jan 8, 2025

@juliasilge thank you for your response I appreciate the clarification! would it make sense to include this as a shortcut in the Positron keyboard shortcut guide website to gain more visibility outside the Positron discussions?

https://positron.posit.co/keyboard-shortcuts.html

@juliasilge
Copy link
Contributor

It's been pointed out to me that @anbrav0 is specifically raising the issue of how to get out of a continuation prompt, not just any old incomplete code at the console prompt. Setting up Esc to cancel continuation may be an option we want to pursue.

@juliasilge juliasilge added enhancement New feature or request area: console Issues related to Console category. support labels Jan 8, 2025
@juliasilge juliasilge changed the title Console: Escape behavior when typing incomplete code in Positron console is not the same as escape behavior in RStudios console Console: should Esc cancel a continuation prompt? Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: console Issues related to Console category. enhancement New feature or request support
Projects
None yet
Development

No branches or pull requests

2 participants