Open pclouds opened 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.
read-line/edit
is a library procedure and can't force other threads' mask to make sure only the thread calling read-line/edit
gets the signal. Worse, there can be a case that multiple threads calling read-line/edit
but SIGCONT is delivered to one of them.My plan is to have a mechanism that central SIGCONT handler dispatches some sort of wake-up signals to threads that request such notification.
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.
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.
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.
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.