Raw event support with new tcell

This commit is contained in:
Zachary Yedidia
2019-12-31 22:34:43 -05:00
parent a2916c0e32
commit a2f7080602
5 changed files with 16 additions and 11 deletions

View File

@@ -9,9 +9,9 @@ import (
"unicode"
"github.com/flynn/json5"
"github.com/zyedidia/tcell"
"github.com/zyedidia/micro/internal/config"
"github.com/zyedidia/micro/internal/screen"
"github.com/zyedidia/tcell"
)
func InitBindings() {
@@ -83,6 +83,7 @@ modSearch:
k = k[5:]
modifiers |= tcell.ModShift
case strings.HasPrefix(k, "\x1b"):
screen.Screen.RegisterRawSeq(k)
return RawEvent{
esc: k,
}, true

View File

@@ -6,13 +6,13 @@ import (
luar "layeh.com/gopher-luar"
"github.com/zyedidia/tcell"
lua "github.com/yuin/gopher-lua"
"github.com/zyedidia/micro/internal/buffer"
"github.com/zyedidia/micro/internal/config"
"github.com/zyedidia/micro/internal/display"
ulua "github.com/zyedidia/micro/internal/lua"
"github.com/zyedidia/micro/internal/screen"
"github.com/zyedidia/tcell"
)
type BufKeyAction func(*BufPane) bool
@@ -261,11 +261,11 @@ func (h *BufPane) HandleEvent(event tcell.Event) {
}
switch e := event.(type) {
// case *tcell.EventRaw:
// re := RawEvent{
// esc: e.EscSeq(),
// }
// h.DoKeyEvent(re)
case *tcell.EventRaw:
re := RawEvent{
esc: e.EscSeq(),
}
h.DoKeyEvent(re)
case *tcell.EventPaste:
h.paste(e.Text())
h.Relocate()