X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=internal%2Faction%2Ftermpane.go;h=7fc0b8d1c2f386f3bc2699d13acd26855e6b1e4a;hb=90304fb472fab5a9809feb0d9b23b0930619cf0d;hp=b5a2da527f22ca4c3671312ef337688f10e1043f;hpb=35375a6ea21281d327177a767b5bce45b0afdce4;p=micro.git diff --git a/internal/action/termpane.go b/internal/action/termpane.go index b5a2da52..7fc0b8d1 100644 --- a/internal/action/termpane.go +++ b/internal/action/termpane.go @@ -1,6 +1,7 @@ package action import ( + "errors" "runtime" "github.com/zyedidia/clipboard" @@ -17,15 +18,21 @@ type TermPane struct { mouseReleased bool id uint64 + tab *Tab } -func NewTermPane(x, y, w, h int, t *shell.Terminal, id uint64) *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.Terminal = t th.id = id th.mouseReleased = true th.Window = display.NewTermWindow(x, y, w, h, t) - return th + th.tab = tab + return th, nil } func (t *TermPane) ID() uint64 { @@ -36,6 +43,14 @@ func (t *TermPane) SetID(i uint64) { t.id = i } +func (t *TermPane) SetTab(tab *Tab) { + t.tab = tab +} + +func (t *TermPane) Tab() *Tab { + return t.tab +} + func (t *TermPane) Close() {} func (t *TermPane) Quit() { @@ -80,8 +95,12 @@ func (t *TermPane) HandleEvent(event tcell.Event) { } else if t.Status != shell.TTDone { t.WriteString(event.EscSeq()) } + } else if _, ok := event.(*tcell.EventPaste); ok { + if t.Status != shell.TTDone { + t.WriteString(event.EscSeq()) + } } else if e, ok := event.(*tcell.EventMouse); e != nil && (!ok || t.State.Mode(terminal.ModeMouseMask)) { - t.WriteString(event.EscSeq()) + // t.WriteString(event.EscSeq()) } else if e != nil { x, y := e.Position() v := t.GetView()