Merge pull request #1349 from jmorganca/mxyng/ctrl-z

handle ctrl+z
This commit is contained in:
Michael Yang 2023-12-01 16:21:49 -08:00 committed by GitHub
commit b3f6c6598f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -191,6 +191,15 @@ func (i *Instance) Readline() (string, error) {
buf.ClearScreen()
case CharCtrlW:
buf.DeleteWord()
case CharCtrlZ:
if err := UnsetRawMode(fd, termios); err != nil {
return "", err
}
syscall.Kill(0, syscall.SIGSTOP)
// on resume...
return "", nil
case CharEnter:
output := buf.String()
if output != "" {