]> git.lizzy.rs Git - micro.git/commitdiff
Escape sequence support
authorZachary Yedidia <zyedidia@gmail.com>
Wed, 1 Jan 2020 02:50:26 +0000 (21:50 -0500)
committerZachary Yedidia <zyedidia@gmail.com>
Wed, 1 Jan 2020 02:50:26 +0000 (21:50 -0500)
internal/action/rawpane.go
internal/action/termpane.go

index 58320ea22ef46aca61fa66ece912fe5486554c4f..cdeade478cee53a3dc6192028f20e6965ea76530 100644 (file)
@@ -1,11 +1,12 @@
 package action
 
 import (
+       "fmt"
        "reflect"
 
-       "github.com/zyedidia/tcell"
        "github.com/zyedidia/micro/internal/buffer"
        "github.com/zyedidia/micro/internal/display"
+       "github.com/zyedidia/tcell"
 )
 
 type RawPane struct {
@@ -34,7 +35,6 @@ func (h *RawPane) HandleEvent(event tcell.Event) {
        }
 
        h.Buf.Insert(h.Cursor.Loc, reflect.TypeOf(event).String()[7:])
-       // h.Buf.Insert(h.Cursor.Loc, fmt.Sprintf(": %q\n", event.EscSeq()))
-       h.Buf.Insert(h.Cursor.Loc, "\n")
+       h.Buf.Insert(h.Cursor.Loc, fmt.Sprintf(": %q\n", event.EscSeq()))
        h.Relocate()
 }
index 8d511f9bd89fcb08bf7714c1da7cddf732dcbd52..b5a2da527f22ca4c3671312ef337688f10e1043f 100644 (file)
@@ -3,11 +3,11 @@ package action
 import (
        "runtime"
 
-       "github.com/zyedidia/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"
 )
 
@@ -78,10 +78,10 @@ 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(string(e.Rune()))
+                       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()