micro/internal/action/terminal_supported.go

33 lines
689 B
Go
Raw Normal View History

2019-08-26 21:47:27 +03:00
// +build linux darwin dragonfly openbsd_amd64 freebsd
package action
import (
2020-01-03 02:30:51 +03:00
shellquote "github.com/kballard/go-shellquote"
2019-08-26 21:47:27 +03:00
"github.com/zyedidia/micro/internal/shell"
)
const TermEmuSupported = true
func RunTermEmulator(h *BufPane, input string, wait bool, getOutput bool, callback string, userargs []interface{}) error {
2020-01-03 02:30:51 +03:00
args, err := shellquote.Split(input)
2019-08-26 21:47:27 +03:00
if err != nil {
return err
}
if len(args) == 0 {
return nil
}
2019-08-26 21:47:27 +03:00
t := new(shell.Terminal)
t.Start(args, getOutput, wait, callback, userargs)
h.AddTab()
2019-12-30 06:02:14 +03:00
id := MainTab().Panes[0].ID()
2019-08-26 21:47:27 +03:00
v := h.GetView()
MainTab().Panes[0] = NewTermPane(v.X, v.Y, v.Width, v.Height, t, id)
MainTab().SetActive(0)
return nil
}