Use upstream updated zyedidia tcell

This commit is contained in:
Zachary Yedidia 2019-12-31 20:15:45 -05:00
parent 6632ab0a77
commit 0301e3539e
20 changed files with 23 additions and 32 deletions

View File

@ -7,7 +7,7 @@ import (
"os"
"sort"
"github.com/gdamore/tcell"
"github.com/zyedidia/tcell"
"github.com/go-errors/errors"
isatty "github.com/mattn/go-isatty"
"github.com/zyedidia/micro/internal/action"

3
go.mod
View File

@ -6,7 +6,6 @@ require (
github.com/flynn/json5 v0.0.0-20160717195620-7620272ed633
github.com/gdamore/tcell v1.3.0
github.com/go-errors/errors v1.0.1
github.com/lucasb-eyer/go-colorful v1.0.3 // indirect
github.com/mattn/go-isatty v0.0.11
github.com/mattn/go-runewidth v0.0.7
github.com/mitchellh/go-homedir v1.1.0
@ -16,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-20191228235154-5b9bbc0d56c7
github.com/zyedidia/tcell v0.0.0-20200101010555-3d6f590fde0b
github.com/zyedidia/terminal v0.0.0-20180726154117-533c623e2415
golang.org/x/text v0.3.2
gopkg.in/yaml.v2 v2.2.7

2
go.sum
View File

@ -55,6 +55,8 @@ github.com/zyedidia/tcell v0.0.0-20191227234059-2c574ec1b972 h1:tqsPH3tvIF9LQMWQ
github.com/zyedidia/tcell v0.0.0-20191227234059-2c574ec1b972/go.mod h1:yXgdp23+aW8OMENYVBvpKoeiBtjaVWJ9HhpPDu6LBfM=
github.com/zyedidia/tcell v0.0.0-20191228235154-5b9bbc0d56c7 h1:Qw5255OIirY741L/Kt5KLitfzfhpk29x+A193zByTS0=
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/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=

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/gdamore/tcell"
"github.com/zyedidia/tcell"
)
// ScrollUp is not an action

View File

@ -9,7 +9,7 @@ import (
"unicode"
"github.com/flynn/json5"
"github.com/gdamore/tcell"
"github.com/zyedidia/tcell"
"github.com/zyedidia/micro/internal/config"
"github.com/zyedidia/micro/internal/screen"
)

View File

@ -6,7 +6,7 @@ import (
luar "layeh.com/gopher-luar"
"github.com/gdamore/tcell"
"github.com/zyedidia/tcell"
lua "github.com/yuin/gopher-lua"
"github.com/zyedidia/micro/internal/buffer"
"github.com/zyedidia/micro/internal/config"
@ -266,9 +266,9 @@ func (h *BufPane) HandleEvent(event tcell.Event) {
// esc: e.EscSeq(),
// }
// h.DoKeyEvent(re)
// case *tcell.EventPaste:
// h.paste(e.Text())
// h.Relocate()
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/gdamore/tcell"
"github.com/zyedidia/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/gdamore/tcell"
"github.com/zyedidia/tcell"
)
type InfoKeyAction func(*InfoPane)

View File

@ -3,7 +3,7 @@ package action
import (
"reflect"
"github.com/gdamore/tcell"
"github.com/zyedidia/tcell"
"github.com/zyedidia/micro/internal/buffer"
"github.com/zyedidia/micro/internal/display"
)

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/gdamore/tcell"
"github.com/zyedidia/tcell"
)
// The TabList is a list of tabs and a window to display the tab bar

View File

@ -3,7 +3,7 @@ package action
import (
"runtime"
"github.com/gdamore/tcell"
"github.com/zyedidia/tcell"
"github.com/zyedidia/clipboard"
"github.com/zyedidia/micro/internal/display"
"github.com/zyedidia/micro/internal/screen"
@ -78,7 +78,7 @@ 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(string(e.Rune()))
}
} else if e, ok := event.(*tcell.EventMouse); e != nil && (!ok || t.State.Mode(terminal.ModeMouseMask)) {
// t.WriteString(event.EscSeq())

View File

@ -3,7 +3,6 @@ package buffer
import (
"fmt"
"io"
"log"
"os"
"time"
@ -37,7 +36,6 @@ func (b *Buffer) Backup(checkTime bool) error {
if checkTime {
sub := time.Now().Sub(b.lastbackup)
if sub < time.Duration(backupTime)*time.Millisecond {
log.Println("Backup event but not enough time has passed", sub)
return nil
}
}
@ -47,13 +45,10 @@ func (b *Buffer) Backup(checkTime bool) error {
backupdir := config.ConfigDir + "/backups/"
if _, err := os.Stat(backupdir); os.IsNotExist(err) {
os.Mkdir(backupdir, os.ModePerm)
log.Println("Creating backup dir")
}
name := backupdir + util.EscapePath(b.AbsPath)
log.Println("Backing up to", name)
err := overwriteFile(name, encoding.Nop, func(file io.Writer) (e error) {
if len(b.lines) == 0 {
return

View File

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

View File

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

View File

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

View File

@ -246,13 +246,11 @@ func PluginListRuntimeFiles(fileType RTFiletype) []string {
// PluginAddRuntimeFile adds a file to the runtime files for a plugin
func PluginAddRuntimeFile(plugin string, filetype RTFiletype, filePath string) error {
log.Println("PLUGIN ADD:", plugin)
pl := FindPlugin(plugin)
if pl == nil {
return errors.New("Plugin " + plugin + " does not exist")
}
pldir := pl.DirName
log.Println("DIRNAME:", pldir)
fullpath := filepath.Join(ConfigDir, "plug", pldir, filePath)
if _, err := os.Stat(fullpath); err == nil {
AddRuntimeFile(filetype, realFile(fullpath))

View File

@ -1,16 +1,15 @@
package display
import (
"log"
"strconv"
"unicode/utf8"
"github.com/zyedidia/tcell"
runewidth "github.com/mattn/go-runewidth"
"github.com/zyedidia/micro/internal/buffer"
"github.com/zyedidia/micro/internal/config"
"github.com/zyedidia/micro/internal/screen"
"github.com/zyedidia/micro/internal/util"
"github.com/gdamore/tcell"
)
// The BufWindow provides a way of displaying a certain section
@ -123,7 +122,6 @@ func (w *BufWindow) Bottomline() int {
l := w.LocFromVisual(buffer.Loc{0, w.Y + w.Height})
log.Println("Bottom line:", l.Y)
return l.Y
}
@ -134,7 +132,6 @@ func (w *BufWindow) Relocate() bool {
b := w.Buf
// how many buffer lines are in the view
height := w.Bottomline() + 1 - w.StartLine
log.Printf("Height: %d, w.Height: %d\n", height, w.Height)
h := w.Height
if w.drawStatus {
h--

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/gdamore/tcell"
"github.com/zyedidia/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/gdamore/tcell"
"github.com/zyedidia/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/gdamore/tcell"
"github.com/zyedidia/tcell"
)
// Screen is the tcell screen we use to draw to the terminal