Escape sequence support

This commit is contained in:
Zachary Yedidia
2019-12-31 21:50:26 -05:00
parent 0301e3539e
commit a2916c0e32
2 changed files with 6 additions and 6 deletions

View 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()
}

View 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()