Merge
This commit is contained in:
commit
71f5f043fb
3 changed files with 24 additions and 4 deletions
|
@ -807,6 +807,11 @@ func (h *BufPane) ReplaceAllCmd(args []string) {
|
||||||
func (h *BufPane) TermCmd(args []string) {
|
func (h *BufPane) TermCmd(args []string) {
|
||||||
ps := h.tab.Panes
|
ps := h.tab.Panes
|
||||||
|
|
||||||
|
if !TermEmuSupported {
|
||||||
|
InfoBar.Error("Terminal emulator not supported on this system")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
sh := os.Getenv("SHELL")
|
sh := os.Getenv("SHELL")
|
||||||
if sh == "" {
|
if sh == "" {
|
||||||
|
@ -830,7 +835,12 @@ func (h *BufPane) TermCmd(args []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
v := h.GetView()
|
v := h.GetView()
|
||||||
MainTab().Panes[i] = NewTermPane(v.X, v.Y, v.Width, v.Height, t, id, MainTab())
|
tp, err := NewTermPane(v.X, v.Y, v.Width, v.Height, t, id, MainTab())
|
||||||
|
if err != nil {
|
||||||
|
InfoBar.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
MainTab().Panes[i] = tp
|
||||||
MainTab().SetActive(i)
|
MainTab().SetActive(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,12 @@ func RunTermEmulator(h *BufPane, input string, wait bool, getOutput bool, callba
|
||||||
id := MainTab().Panes[0].ID()
|
id := MainTab().Panes[0].ID()
|
||||||
|
|
||||||
v := h.GetView()
|
v := h.GetView()
|
||||||
MainTab().Panes[0] = NewTermPane(v.X, v.Y, v.Width, v.Height, t, id, MainTab())
|
|
||||||
|
tp, err := NewTermPane(v.X, v.Y, v.Width, v.Height, t, id, MainTab())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
MainTab().Panes[0] = tp
|
||||||
MainTab().SetActive(0)
|
MainTab().SetActive(0)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package action
|
package action
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/zyedidia/clipboard"
|
"github.com/zyedidia/clipboard"
|
||||||
|
@ -20,14 +21,18 @@ type TermPane struct {
|
||||||
tab *Tab
|
tab *Tab
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTermPane(x, y, w, h int, t *shell.Terminal, id uint64, tab *Tab) *TermPane {
|
func NewTermPane(x, y, w, h int, t *shell.Terminal, id uint64, tab *Tab) (*TermPane, error) {
|
||||||
|
if !TermEmuSupported {
|
||||||
|
return nil, errors.New("Terminal emulator is not supported on this system")
|
||||||
|
}
|
||||||
|
|
||||||
th := new(TermPane)
|
th := new(TermPane)
|
||||||
th.Terminal = t
|
th.Terminal = t
|
||||||
th.id = id
|
th.id = id
|
||||||
th.mouseReleased = true
|
th.mouseReleased = true
|
||||||
th.Window = display.NewTermWindow(x, y, w, h, t)
|
th.Window = display.NewTermWindow(x, y, w, h, t)
|
||||||
th.tab = tab
|
th.tab = tab
|
||||||
return th
|
return th, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TermPane) ID() uint64 {
|
func (t *TermPane) ID() uint64 {
|
||||||
|
|
Loading…
Reference in a new issue