You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
Sending a script to the background with CTRL-Z (SIGTSTP) and bringing it back to the foreground will result in readline completions behaving strangely.
Need to do both. Just doing tty.setRawMode(true) does not fix the problem.
Hopefully this simple fix will also work on node v7.
However, this sometimes results in characters getting echoed to the terminal twice
in some libraries that rely on readline (such as CoffeeScript and LiveScript).
Example of problem & solution:
joshua@jsw-desktop:~$ node
> var tty=require('tty')
undefined
> reset = function() { tty.setRawMode(false); tty.setRawMode(true); }
[Function]
> // hit Ctrl-Z
undefined
>
[1]+ Stopped node
joshua@jsw-desktop:~$ # resume process
joshua@jsw-desktop:~$ fg
node
undefined
> ^P
> // hit Ctrl-Z^N
> ^P^P^P
> // hit Ctrl-Z^P^P
> reset = function() { tty.setRawMode(false); tty.setRawMode(true); }^N
> // hit Ctrl-Z^N
> reset()
reset()
undefined
> // now ^N (next line) and ^P (previous line) work normally