mirror of https://github.com/Hilbis/Hilbish
fix: only resize term if not running command
parent
5a258ce68e
commit
77cc7fe24a
26
main.go
26
main.go
|
@ -5,18 +5,19 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"os/signal"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"hilbish/golibs/bait"
|
||||
|
||||
"github.com/pborman/getopt"
|
||||
"github.com/yuin/gopher-lua"
|
||||
"layeh.com/gopher-luar"
|
||||
"golang.org/x/term"
|
||||
"layeh.com/gopher-luar"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -258,14 +259,21 @@ func fmtPrompt() string {
|
|||
// do i even have to say
|
||||
func HandleSignals() {
|
||||
c := make(chan os.Signal)
|
||||
signal.Notify(c, os.Interrupt)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGWINCH)
|
||||
|
||||
for range c {
|
||||
if !running {
|
||||
if !interactive {
|
||||
os.Exit(0)
|
||||
for s := range c {
|
||||
switch s {
|
||||
case os.Interrupt:
|
||||
if !running {
|
||||
if !interactive {
|
||||
os.Exit(0)
|
||||
}
|
||||
lr.ClearInput()
|
||||
}
|
||||
case syscall.SIGWINCH:
|
||||
if !running {
|
||||
lr.Resize()
|
||||
}
|
||||
lr.ClearInput()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
4
rl.go
4
rl.go
|
@ -1,3 +1,4 @@
|
|||
//go:build !hilbiline
|
||||
// +build !hilbiline
|
||||
|
||||
package main
|
||||
|
@ -41,3 +42,6 @@ func (lr *LineReader) ClearInput() {
|
|||
readline.RefreshLine()
|
||||
}
|
||||
|
||||
func (lr *LineReader) Resize() {
|
||||
readline.Resize()
|
||||
}
|
||||
|
|
|
@ -37,3 +37,7 @@ func (lr *LineReader) ClearInput() {
|
|||
return
|
||||
}
|
||||
|
||||
func (lr *LineReader) Resize() {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue