]> git.lizzy.rs Git - micro.git/blobdiff - internal/action/termpane.go
Create bindings.json if it does not exist
[micro.git] / internal / action / termpane.go
index bde15ae060a4483c63573ddc9cdf550a01925d21..540b23150f5cb26596d119a2c55a58a6e5bd40f7 100644 (file)
@@ -3,11 +3,11 @@ package action
 import (
        "runtime"
 
-       "github.com/gdamore/tcell"
        "github.com/zyedidia/clipboard"
        "github.com/zyedidia/micro/internal/display"
        "github.com/zyedidia/micro/internal/screen"
        "github.com/zyedidia/micro/internal/shell"
+       "github.com/zyedidia/tcell"
        "github.com/zyedidia/terminal"
 )
 
@@ -17,14 +17,16 @@ 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 {
        th := new(TermPane)
        th.Terminal = t
        th.id = id
        th.mouseReleased = true
        th.Window = display.NewTermWindow(x, y, w, h, t)
+       th.tab = tab
        return th
 }
 
@@ -36,6 +38,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() {
@@ -78,7 +88,11 @@ func (t *TermPane) HandleEvent(event tcell.Event) {
                        clipboard.WriteAll(t.GetSelection(t.GetView().Width), "clipboard")
                        InfoBar.Message("Copied selection to clipboard")
                } else if t.Status != shell.TTDone {
-                       // t.WriteString(event.EscSeq())
+                       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())