Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
7a1b37ac
Unverified
Commit
7a1b37ac
authored
Dec 11, 2023
by
Bruce MacDonald
Committed by
GitHub
Dec 11, 2023
Browse files
os specific ctrl-z (#1420)
parent
5d4d2e2c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
8 deletions
+25
-8
readline/readline.go
readline/readline.go
+1
-8
readline/readline_unix.go
readline/readline_unix.go
+18
-0
readline/readline_windows.go
readline/readline_windows.go
+6
-0
No files found.
readline/readline.go
View file @
7a1b37ac
...
@@ -192,14 +192,7 @@ func (i *Instance) Readline() (string, error) {
...
@@ -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
!=
""
{
...
...
readline/readline_unix.go
0 → 100644
View file @
7a1b37ac
//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
}
readline/readline_windows.go
0 → 100644
View file @
7a1b37ac
package
readline
func
handleCharCtrlZ
(
fd
int
,
state
*
State
)
(
string
,
error
)
{
// not supported
return
""
,
nil
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment