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

Not able to escape read-line in the output window #783

Closed
pedro-w opened this issue Sep 18, 2020 · 2 comments
Closed

Not able to escape read-line in the output window #783

pedro-w opened this issue Sep 18, 2020 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@pedro-w
Copy link

pedro-w commented Sep 18, 2020

I had some code with interactive input using read-line.

(ns cc.core)
(defn me []
  (loop [l (read-line)]
    (when l
      (prn l)
      (recur (read-line)))))

(this is a minimal example)
If run from a normal terminal it's possible to exit the loop by entering EOF (^Z in my case), as read-line will then return nil.

If run from the Calva output window, the editor pops up a little box, titled REPL Input, to enter the input. From there

  • it's not possible to enter ^Z
  • pressing ESC just prints "No input provided"
  • attempting to disconnect the session is not possible, either from the nREPL icon at the bottom or from the Command palette, because the REPL Input box takes priority.
    As far as I can see the only way out is to quit the editor.

Is there another way to indicate EOF to the running code, or otherwise break out of the loop?

Using Clojure 1.10.1, Windows 10, VSCode 1.49.1, Calva 2.0.124

@bpringe
Copy link
Member

bpringe commented Sep 18, 2020

Tested this myself, never seen this before but I do see what you mean. It made me chuckle 😄. I have a couple of notes:

  • You can get out of this loop without closing the editor by terminating the repl session in the terminal.
  • You can also run the Calva command "Interrupt running Evaluations" via the shortcut keys (in my case: ctrl+alt+c ctrl+alt+d)

@PEZ Is there anything else we should do about this particular situation? I see that this is occurring here:

this.out("No input provided.");

Perhaps we should interrupt the evaluation at this point, when there's no input (user hit Esc in the prompt)?

@PEZ
Copy link
Collaborator

PEZ commented Sep 18, 2020

We should make dismissal of the input picker send cttl+z, probably.

@bpringe bpringe added the bug Something isn't working label Sep 19, 2020
@bpringe bpringe added the good first issue Good for newcomers label Dec 28, 2020
xfthhxk added a commit to xfthhxk/calva that referenced this issue Oct 29, 2021
PEZ added a commit that referenced this issue Oct 29, 2021
xfthhxk added a commit to xfthhxk/calva that referenced this issue Oct 29, 2021
@bpringe bpringe closed this as completed in 73bdde8 Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants