summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-11-03 22:59:57 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-11-03 23:00:34 +0900
commit6bddffbca46e3bfdc0d858c65c8e4444dfa5b4b5 (patch)
tree5ef616173678403f227a19635a12efef56ca713e
parent81a88693c12507bcc460bd1150af0f48f917670c (diff)
Setup signal handlers before ncurses initialization
This prevents fzf from missing SIGWINCH during startup which occasionally happens with fzf-tmux
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/terminal.go30
2 files changed, 16 insertions, 15 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9fea9735..cd9a173f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ CHANGELOG
orthogonally controlling "exactness" of search
- Fixed not to display non-printable characters
- Added `double-click` for `--bind` option
+- More robust handling of SIGWINCH
0.10.8
------
diff --git a/src/terminal.go b/src/terminal.go
index 4f8341da..ed79728d 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -713,21 +713,6 @@ func executeCommand(template string, current string) {
func (t *Terminal) Loop() {
<-t.startChan
{ // Late initialization
- t.mutex.Lock()
- t.initFunc()
- t.calculateMargins()
- t.printPrompt()
- t.placeCursor()
- C.Refresh()
- t.printInfo()
- t.printHeader()
- t.mutex.Unlock()
- go func() {
- timer := time.NewTimer(initialDelay)
- <-timer.C
- t.reqBox.Set(reqRefresh, nil)
- }()
-
intChan := make(chan os.Signal, 1)
signal.Notify(intChan, os.Interrupt, os.Kill)
go func() {
@@ -744,6 +729,21 @@ func (t *Terminal) Loop() {
}
}()
+ t.mutex.Lock()
+ t.initFunc()
+ t.calculateMargins()
+ t.printPrompt()
+ t.placeCursor()
+ C.Refresh()
+ t.printInfo()
+ t.printHeader()
+ t.mutex.Unlock()
+ go func() {
+ timer := time.NewTimer(initialDelay)
+ <-timer.C
+ t.reqBox.Set(reqRefresh, nil)
+ }()
+
// Keep the spinner spinning
go func() {
for {