shirok / Gauche

Scheme Scripting Engine
https://practical-scheme.net/gauche
Other
801 stars 81 forks source link

line-edit stops working after C-z #715

Open pclouds opened 4 years ago

pclouds commented 4 years ago

Make a multi-line expression, but don't evaluate. Ctrl-Z to move gosh to background, then bring it back foreground again. All the control keys stop working. I guess we need to reset the tty back to the right mode, but I'm not sure what kind of signal we get (if any) after resuming on foreground again.

shirok commented 4 years ago

Basically, we have to install SIGCONT handler and reset the terminal. It is not too difficult if we have a stand-alone app. But as a library it gets trickier.

My plan is to have a mechanism that central SIGCONT handler dispatches some sort of wake-up signals to threads that request such notification.

pclouds commented 4 years ago

The good news is python isn't doing any better here. And in gosh if I Ctrl-C, then it gets back to normal. Ther user just has to know to type Ctrl-C :)

Another weird thing. After 'fg', I would expect "enter" to complete the expression and evaluate it, then the next prompt will have everything back to normal (that happens with python). But Enter does not seem to do anything. In the end (cant remember what I typed) I got

......*** ERROR: character required, but got #<eof>
Stack Trace:
_______________________________________
  0  (read-line/edit ctx)
        at "/home/pclouds/opt/gauche/share/gauche-0.97/0.9.10_pre1/lib/gauche/interactive/editable-reader.scm":66
  1  (read)
        at "/home/pclouds/opt/gauche/share/gauche-0.97/0.9.10_pre1/lib/gauche/interactive.scm":252

maybe lineedit library needs to handle this special "eof" situation too.

shirok commented 4 years ago

I put SIGCONT handling in place. I can't guarantee the thread calling read-line/edit receives the signal, so the handling of situation is a bit delayed--the user must type ENTER to reset the terminal back.

shirok commented 3 years ago

Actually, read-line/edit could also take entire control of the terminal so that it could inetrcept C-z. We may consider it as well.