Switch to gdamore/tcell

This commit is contained in:
Zachary Yedidia
2019-12-31 17:23:12 -05:00
parent 466c48da31
commit 6632ab0a77
18 changed files with 35 additions and 31 deletions

View File

@@ -14,7 +14,7 @@ import (
"github.com/zyedidia/micro/internal/shell"
"github.com/zyedidia/micro/internal/util"
"github.com/zyedidia/micro/pkg/shellwords"
"github.com/zyedidia/tcell"
"github.com/gdamore/tcell"
)
// ScrollUp is not an action

View File

@@ -9,9 +9,9 @@ import (
"unicode"
"github.com/flynn/json5"
"github.com/gdamore/tcell"
"github.com/zyedidia/micro/internal/config"
"github.com/zyedidia/micro/internal/screen"
"github.com/zyedidia/tcell"
)
func InitBindings() {
@@ -374,8 +374,6 @@ var keyEvents = map[string]tcell.Key{
"CtrlRightSq": tcell.KeyCtrlRightSq,
"CtrlCarat": tcell.KeyCtrlCarat,
"CtrlUnderscore": tcell.KeyCtrlUnderscore,
"CtrlPageUp": tcell.KeyCtrlPgUp,
"CtrlPageDown": tcell.KeyCtrlPgDn,
"Tab": tcell.KeyTab,
"Esc": tcell.KeyEsc,
"Escape": tcell.KeyEscape,

View File

@@ -6,13 +6,13 @@ import (
luar "layeh.com/gopher-luar"
"github.com/gdamore/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,14 +261,14 @@ func (h *BufPane) HandleEvent(event tcell.Event) {
}
switch e := event.(type) {
case *tcell.EventRaw:
re := RawEvent{
esc: e.EscSeq(),
}
h.DoKeyEvent(re)
case *tcell.EventPaste:
h.paste(e.Text())
h.Relocate()
// case *tcell.EventRaw:
// re := RawEvent{
// esc: e.EscSeq(),
// }
// h.DoKeyEvent(re)
// case *tcell.EventPaste:
// h.paste(e.Text())
// h.Relocate()
case *tcell.EventKey:
ke := KeyEvent{
code: e.Key(),

View File

@@ -1,7 +1,7 @@
package action
import (
"github.com/zyedidia/tcell"
"github.com/gdamore/tcell"
)
type Event interface{}

View File

@@ -7,7 +7,7 @@ import (
"github.com/zyedidia/micro/internal/display"
"github.com/zyedidia/micro/internal/info"
"github.com/zyedidia/micro/internal/util"
"github.com/zyedidia/tcell"
"github.com/gdamore/tcell"
)
type InfoKeyAction func(*InfoPane)

View File

@@ -1,12 +1,11 @@
package action
import (
"fmt"
"reflect"
"github.com/gdamore/tcell"
"github.com/zyedidia/micro/internal/buffer"
"github.com/zyedidia/micro/internal/display"
"github.com/zyedidia/tcell"
)
type RawPane struct {
@@ -35,6 +34,7 @@ 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, fmt.Sprintf(": %q\n", event.EscSeq()))
h.Buf.Insert(h.Cursor.Loc, "\n")
h.Relocate()
}

View File

@@ -6,7 +6,7 @@ import (
"github.com/zyedidia/micro/internal/display"
"github.com/zyedidia/micro/internal/screen"
"github.com/zyedidia/micro/internal/views"
"github.com/zyedidia/tcell"
"github.com/gdamore/tcell"
)
// The TabList is a list of tabs and a window to display the tab bar

View 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"
)
@@ -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(event.EscSeq())
// 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()

View File

@@ -2,7 +2,7 @@ package buffer
import (
"github.com/zyedidia/micro/internal/config"
"github.com/zyedidia/tcell"
"github.com/gdamore/tcell"
)
type MsgType int

View File

@@ -6,7 +6,7 @@ import (
"strconv"
"strings"
"github.com/zyedidia/tcell"
"github.com/gdamore/tcell"
)
// Micro's default style

View File

@@ -4,7 +4,7 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/zyedidia/tcell"
"github.com/gdamore/tcell"
)
func TestSimpleStringToStyle(t *testing.T) {

View File

@@ -10,7 +10,7 @@ import (
"github.com/zyedidia/micro/internal/config"
"github.com/zyedidia/micro/internal/screen"
"github.com/zyedidia/micro/internal/util"
"github.com/zyedidia/tcell"
"github.com/gdamore/tcell"
)
// The BufWindow provides a way of displaying a certain section

View File

@@ -9,7 +9,7 @@ import (
"github.com/zyedidia/micro/internal/info"
"github.com/zyedidia/micro/internal/screen"
"github.com/zyedidia/micro/internal/util"
"github.com/zyedidia/tcell"
"github.com/gdamore/tcell"
)
type InfoWindow struct {

View File

@@ -7,7 +7,7 @@ import (
"github.com/zyedidia/micro/internal/config"
"github.com/zyedidia/micro/internal/screen"
"github.com/zyedidia/micro/internal/shell"
"github.com/zyedidia/tcell"
"github.com/gdamore/tcell"
"github.com/zyedidia/terminal"
)

View File

@@ -7,7 +7,7 @@ import (
"github.com/zyedidia/micro/internal/config"
"github.com/zyedidia/micro/pkg/terminfo"
"github.com/zyedidia/tcell"
"github.com/gdamore/tcell"
)
// Screen is the tcell screen we use to draw to the terminal