willghatch / racket-rash

The Reckless Racket Shell
http://rash-lang.org
Other
551 stars 31 forks source link

Behavior of Control-c (C-c, ^C, SIGINT) when no process is active #88

Closed nwg closed 3 years ago

nwg commented 3 years ago

Rash behavior for when no process is running and controlling terminal sends actual C-c seems like it might have a bug.

Phase 1

This is the output i get in rash for C-c C-c C-c "echo hi" RET

3:02 /Users/griswold/
> #(struct:exn:break user break #<continuation-mark-set> #<procedure>)
3:02 /Users/griswold/
^C#(struct:exn:break user break #<continuation-mark-set> #<procedure>)
3:02 /Users/griswold/
^C#(struct:exn:break user break #<continuation-mark-set> #<procedure>)
3:02 /Users/griswold/
echo hi  
echo hi
hi
3:02 /Users/griswold/
> 

Note the command i entered (echo hi) is repeated back to me.

Phase 2

After the echo finishes, further C-c presses generate nothing, but interestingly, upon one further press of C-c, a little bracket suddenly appears to the left of my current prompt. It's very small and just to the left of the >, i have to zoom in to see it.

image

What is that bracket? Is that a feature?

Note: on my Linux box, i have to press RET after every C-c to get the exn:break message. I guess my os x terminal seems to be sending something different to rash upon C-c that has the effective behavior of sending an additional RET on linux. Everything else appears to behave the same.

I am running Racket v8.1 [cs] on all systems.

Side note: In all shells i've used (zsh, bash, csh) sending a SIGINT clears the current line. I don't know how i got into the habit of using this to clear the line, maybe it is bad, but i use it all the time. I don't know what behavior is best for rash here, but just as a user report, it caught me off guard.

nwg commented 3 years ago

Oops, i didn't look long enough and it seems this is mostly a duplicate of #78. Hm. I guess it should be merged. The only new stuff here is the question about the little bracket and the explanation of the different behavior between darwin and linux.

willghatch commented 3 years ago

Hmm, I'm not sure what's up with the bracket. What terminal emulator are you using? At any rate, I'll probably close this issue and just leave #78 open unless this bracket thing ends up being important. But it might be related to the terminal emulator and the way C-c works.

nwg commented 3 years ago

@willghatch the bracket thing happens for me in the regular racket repl, too, so it's more of a general issue.