From 88620e983a75bd1744cd6770aa17e63a4e78723f Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Fri, 1 Dec 2023 16:04:09 -0800 Subject: [PATCH] handle ctrl+z --- readline/readline.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/readline/readline.go b/readline/readline.go index 88813fc6..781ac8a3 100644 --- a/readline/readline.go +++ b/readline/readline.go @@ -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 != "" {