mirror of
https://github.com/tcsenpai/ollama.git
synced 2025-06-06 19:25:21 +00:00
os specific ctrl-z (#1420)
This commit is contained in:
parent
5d4d2e2c60
commit
7a1b37ac64
@ -192,14 +192,7 @@ func (i *Instance) Readline() (string, error) {
|
|||||||
case CharCtrlW:
|
case CharCtrlW:
|
||||||
buf.DeleteWord()
|
buf.DeleteWord()
|
||||||
case CharCtrlZ:
|
case CharCtrlZ:
|
||||||
if err := UnsetRawMode(fd, termios); err != nil {
|
return handleCharCtrlZ(fd, termios)
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
syscall.Kill(0, syscall.SIGSTOP)
|
|
||||||
|
|
||||||
// on resume...
|
|
||||||
return "", nil
|
|
||||||
case CharEnter:
|
case CharEnter:
|
||||||
output := buf.String()
|
output := buf.String()
|
||||||
if output != "" {
|
if output != "" {
|
||||||
|
18
readline/readline_unix.go
Normal file
18
readline/readline_unix.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
//go:build !windows
|
||||||
|
|
||||||
|
package readline
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
func handleCharCtrlZ(fd int, termios *Termios) (string, error) {
|
||||||
|
if err := UnsetRawMode(fd, termios); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
syscall.Kill(0, syscall.SIGSTOP)
|
||||||
|
|
||||||
|
// on resume...
|
||||||
|
return "", nil
|
||||||
|
}
|
6
readline/readline_windows.go
Normal file
6
readline/readline_windows.go
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package readline
|
||||||
|
|
||||||
|
func handleCharCtrlZ(fd int, state *State) (string, error) {
|
||||||
|
// not supported
|
||||||
|
return "", nil
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user