]> git.lizzy.rs Git - micro.git/commitdiff
Raw event support with new tcell
authorZachary Yedidia <zyedidia@gmail.com>
Wed, 1 Jan 2020 03:34:43 +0000 (22:34 -0500)
committerZachary Yedidia <zyedidia@gmail.com>
Wed, 1 Jan 2020 03:34:43 +0000 (22:34 -0500)
cmd/micro/micro.go
go.mod
go.sum
internal/action/bindings.go
internal/action/bufpane.go

index d1c591366c51238bf7079f98471192beef56cc7d..152681d4ca1d415ee41da10eaafc592fc1d2215b 100644 (file)
@@ -7,7 +7,6 @@ import (
        "os"
        "sort"
 
-       "github.com/zyedidia/tcell"
        "github.com/go-errors/errors"
        isatty "github.com/mattn/go-isatty"
        "github.com/zyedidia/micro/internal/action"
@@ -16,6 +15,7 @@ import (
        "github.com/zyedidia/micro/internal/screen"
        "github.com/zyedidia/micro/internal/shell"
        "github.com/zyedidia/micro/internal/util"
+       "github.com/zyedidia/tcell"
 )
 
 var (
@@ -171,6 +171,8 @@ func main() {
                }
        }
 
+       screen.Init()
+
        action.InitBindings()
        action.InitCommands()
 
@@ -188,8 +190,6 @@ func main() {
                screen.TermMessage(err)
        }
 
-       screen.Init()
-
        // If we have an error, we can exit cleanly and not completely
        // mess up the terminal being worked in
        // In other words we need to shut down tcell before the program crashes
diff --git a/go.mod b/go.mod
index 52dbdd1981557af94fcf6631d8a3697a381be450..a64df3c692d0a77486d95ab573e82a2aedf8641a 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -15,7 +15,7 @@ require (
        github.com/zyedidia/glob v0.0.0-20170209203856-dd4023a66dc3
        github.com/zyedidia/poller v0.0.0-20170616160828-ab09682913b7 // indirect
        github.com/zyedidia/pty v2.0.0+incompatible // indirect
-       github.com/zyedidia/tcell v0.0.0-20200101010555-3d6f590fde0b
+       github.com/zyedidia/tcell v0.0.0-20200101033337-8f44670b0885
        github.com/zyedidia/terminal v0.0.0-20180726154117-533c623e2415
        golang.org/x/text v0.3.2
        gopkg.in/yaml.v2 v2.2.7
diff --git a/go.sum b/go.sum
index 09d40ed7f70af9bc9173f89637d1e79040411df9..2886f78ab1317376056517c258d0088801937330 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -57,6 +57,10 @@ github.com/zyedidia/tcell v0.0.0-20191228235154-5b9bbc0d56c7 h1:Qw5255OIirY741L/
 github.com/zyedidia/tcell v0.0.0-20191228235154-5b9bbc0d56c7/go.mod h1:yXgdp23+aW8OMENYVBvpKoeiBtjaVWJ9HhpPDu6LBfM=
 github.com/zyedidia/tcell v0.0.0-20200101010555-3d6f590fde0b h1:WOYC0HHwRKNvDcvVbm5QXfjD+uoBvnqqSxRdjlsXIq0=
 github.com/zyedidia/tcell v0.0.0-20200101010555-3d6f590fde0b/go.mod h1:b7qO+6WpCTSDPZ3ru7R2FNZeEtcNpo+X8m+5Py0/l64=
+github.com/zyedidia/tcell v0.0.0-20200101030217-abaa2102dece h1:Qj15gTpYWVtGA9K7LFkiuBbk5BjMfJJZhrw3e+zKI2k=
+github.com/zyedidia/tcell v0.0.0-20200101030217-abaa2102dece/go.mod h1:b7qO+6WpCTSDPZ3ru7R2FNZeEtcNpo+X8m+5Py0/l64=
+github.com/zyedidia/tcell v0.0.0-20200101033337-8f44670b0885 h1:BB7VLUCQCQm7vQYrePdVzoCtbacfdiHfGJ7NzkoEYeA=
+github.com/zyedidia/tcell v0.0.0-20200101033337-8f44670b0885/go.mod h1:b7qO+6WpCTSDPZ3ru7R2FNZeEtcNpo+X8m+5Py0/l64=
 github.com/zyedidia/terminal v0.0.0-20180726154117-533c623e2415 h1:752dTQ5OatJ9M5ULK2+9lor+nzyZz+LYDo3WGngg3Rc=
 github.com/zyedidia/terminal v0.0.0-20180726154117-533c623e2415/go.mod h1:8leT8G0Cm8NoJHdrrKHyR9MirWoF4YW7pZh06B6H+1E=
 golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
index 5ffc2eefd33cd0ab1e76eba5ed4741305af858f2..3d1162fa6c811ffac2570c1dbf068013ed4fb650 100644 (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
index 3da74e493a5733a47e165a8bd370ff657eb79274..f3a734daf848165c410cd3e3280d5acbe2b2701f 100644 (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()