Setup signal handlers before ncurses initialization

This prevents fzf from missing SIGWINCH during startup which
occasionally happens with fzf-tmux
This commit is contained in:
Junegunn Choi 2015-11-03 22:59:57 +09:00
parent 81a88693c1
commit 6bddffbca4
2 changed files with 16 additions and 15 deletions

View File

@ -9,6 +9,7 @@ CHANGELOG
orthogonally controlling "exactness" of search orthogonally controlling "exactness" of search
- Fixed not to display non-printable characters - Fixed not to display non-printable characters
- Added `double-click` for `--bind` option - Added `double-click` for `--bind` option
- More robust handling of SIGWINCH
0.10.8 0.10.8
------ ------

View File

@ -713,21 +713,6 @@ func executeCommand(template string, current string) {
func (t *Terminal) Loop() { func (t *Terminal) Loop() {
<-t.startChan <-t.startChan
{ // Late initialization { // 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) intChan := make(chan os.Signal, 1)
signal.Notify(intChan, os.Interrupt, os.Kill) signal.Notify(intChan, os.Interrupt, os.Kill)
go func() { 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 // Keep the spinner spinning
go func() { go func() {
for { for {