summaryrefslogtreecommitdiffstats
path: root/src/terminal.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-02-18 00:08:17 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-02-18 00:08:17 +0900
commite808151c287513c9aef35be339b10a2861115ade (patch)
tree3f43b5951c61760f0b7cc85a68639b82a0ac615a /src/terminal.go
parentd760b790b37a5d26b3068ed9f5b4efcaa3cf5cae (diff)
Make --select-1 and --exit-0 asynchronous
Diffstat (limited to 'src/terminal.go')
-rw-r--r--src/terminal.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/terminal.go b/src/terminal.go
index cfed1a0e..3d914ac5 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -40,6 +40,7 @@ type Terminal struct {
mutex sync.Mutex
initFunc func()
suppress bool
+ startChan chan bool
}
type selectedItem struct {
@@ -99,6 +100,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
eventBox: eventBox,
mutex: sync.Mutex{},
suppress: true,
+ startChan: make(chan bool, 1),
initFunc: func() {
C.Init(opts.Color, opts.Color256, opts.Black, opts.Mouse)
}}
@@ -446,6 +448,7 @@ func (t *Terminal) rubout(pattern string) {
// Loop is called to start Terminal I/O
func (t *Terminal) Loop() {
+ <-t.startChan
{ // Late initialization
t.mutex.Lock()
t.initFunc()