Skip to content

Commit

Permalink
remove workaround and use tcell v2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tjmtmmnk committed Feb 26, 2021
1 parent e2dd845 commit 21674d7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
26 changes: 0 additions & 26 deletions fuzzyfinder.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/gdamore/tcell/v2"
"github.com/ktr0731/go-fuzzyfinder/matching"
runewidth "github.com/mattn/go-runewidth"
"github.com/micmonay/keybd_event"
"github.com/pkg/errors"
)

Expand Down Expand Up @@ -678,21 +677,6 @@ func (f *finder) find(slice interface{}, itemFunc func(i int) string, opts []Opt
}
}

// This method avoid tcell bug https://github.com/gdamore/tcell/issues/194
// Additional EOL event is sent to ensure, consequent events, are correctly handled.
func sendExtraEventFix() error {
kb, err := keybd_event.NewKeyBonding()
if err != nil {
return err
}
kb.SetKeys(keybd_event.VK_ENTER)
err = kb.Launching()
if err != nil {
return err
}
return nil
}

// Find displays a UI that provides fuzzy finding against the provided slice.
// The argument slice must be of a slice type. If not, Find returns
// an error. itemFunc is called by the length of slice. previewFunc is called
Expand All @@ -709,11 +693,6 @@ func Find(slice interface{}, itemFunc func(i int) string, opts ...Option) (int,

func (f *finder) Find(slice interface{}, itemFunc func(i int) string, opts ...Option) (int, error) {
res, err := f.find(slice, itemFunc, opts)
if !isInTesting() {
if err := sendExtraEventFix(); err != nil {
return 0, err
}
}

if err != nil {
return 0, err
Expand All @@ -730,11 +709,6 @@ func FindMulti(slice interface{}, itemFunc func(i int) string, opts ...Option) (
func (f *finder) FindMulti(slice interface{}, itemFunc func(i int) string, opts ...Option) ([]int, error) {
opts = append(opts, withMulti())
res, err := f.find(slice, itemFunc, opts)
if !isInTesting() {
if err := sendExtraEventFix(); err != nil {
return nil, err
}
}
return res, err
}

Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ require (
github.com/google/gofuzz v1.2.0
github.com/goreleaser/goreleaser v0.157.0
github.com/mattn/go-runewidth v0.0.10
github.com/micmonay/keybd_event v1.1.0
github.com/nsf/termbox-go v0.0.0-20201124104050-ed494de23a00
github.com/pkg/errors v0.9.1
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
)

go 1.13

0 comments on commit 21674d7

Please sign in to comment.