diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2015-01-23 20:30:50 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-01-23 20:30:50 +0900 |
commit | 48e16edb474a59e74197793c2790f666d394e401 (patch) | |
tree | c434a0ed9670c972f6552e520fbd7ad7bfe5b4f0 /src/terminal.go | |
parent | c35d98dc42e8327ffbfd17701efa3d5fb68eeae0 (diff) |
Redraw and adjust upon terminal resize
Diffstat (limited to 'src/terminal.go')
-rw-r--r-- | src/terminal.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/terminal.go b/src/terminal.go index e5cf64a3..e1eb4c29 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -4,10 +4,12 @@ import ( "bytes" "fmt" "os" + "os/signal" "regexp" "sort" "strings" "sync" + "syscall" "time" C "github.com/junegunn/fzf/src/curses" @@ -452,6 +454,15 @@ func (t *Terminal) Loop() { <-timer.C t.reqBox.Set(reqRefresh, nil) }() + + resizeChan := make(chan os.Signal, 1) + signal.Notify(resizeChan, syscall.SIGWINCH) + go func() { + for { + <-resizeChan + t.reqBox.Set(reqRedraw, nil) + } + }() } go func() { @@ -471,6 +482,8 @@ func (t *Terminal) Loop() { t.suppress = false case reqRedraw: C.Clear() + C.Endwin() + C.Refresh() t.printAll() case reqClose: C.Close() |