Fix Windows build
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Fix #3598
authored by Junegunn Choi · committed by Junegunn Choi · parent beb2de2 · Browse files · 5 files·+30 added−10 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+30 added−10 removed
- other:+30 added−10 removed
Provenance
- Commit
da752fc- Tree
8408c92- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
beb2de2
5 files changed+30 added−10 removed
modified:src/tui/dummy.go+1 added
34 unmodified lines35 func (r *FullscreenRenderer) Resume(bool, bool) {}36 func (r *FullscreenRenderer) PassThrough(string) {}37 func (r *FullscreenRenderer) Clear() {}38 func (r *FullscreenRenderer) NeedScrollbarRedraw() bool { return false }39+func (r *FullscreenRenderer) ShouldEmitResizeEvent() bool { return false }40 func (r *FullscreenRenderer) Refresh() {}41 func (r *FullscreenRenderer) Close() {}42 func (r *FullscreenRenderer) Size() TermSize { return TermSize{} }43 10 unmodified linesmodified:src/tui/light.go+4 added
692 unmodified lines693 func (r *LightRenderer) NeedScrollbarRedraw() bool {694 return false695 }696 697+func (r *LightRenderer) ShouldEmitResizeEvent() bool {698+ return false699+}700+701 func (r *LightRenderer) RefreshWindows(windows []Window) {702 r.flush()703 }704 418 unmodified linesmodified:src/tui/tcell.go+4 added
200 unmodified lines201 func (r *FullscreenRenderer) NeedScrollbarRedraw() bool {202 return true203 }204 205+func (r *FullscreenRenderer) ShouldEmitResizeEvent() bool {206+ return true207+}208+209 func (r *FullscreenRenderer) Refresh() {210 // noop211 }212 580 unmodified linesmodified:src/tui/tui.go+1 added
492 unmodified lines493 Refresh()494 Close()495 PassThrough(string)496 NeedScrollbarRedraw() bool497+ ShouldEmitResizeEvent() bool498 499 GetChar() Event500 501 Top() int320 unmodified linesmodified:src/terminal.go+20 added-10 removed
815 unmodified lines816 }817 }818 }819 820+ var resizeActions []*action820- _, t.hasResizeActions = t.keymap[tui.Resize.AsEvent()]821+ resizeActions, t.hasResizeActions = t.keymap[tui.Resize.AsEvent()]822+ if t.tui.ShouldEmitResizeEvent() {823+ t.keymap[tui.Resize.AsEvent()] = append(toActions(actClearScreen), resizeActions...)824+ }825 _, t.hasResultActions = t.keymap[tui.Result.AsEvent()]826 _, t.hasFocusActions = t.keymap[tui.Focus.AsEvent()]827 _, t.hasLoadActions = t.keymap[tui.Load.AsEvent()]828 2026 unmodified lines2855 t.reqBox.Set(reqReinit, nil)2856 }2857 }()2858 2859+ if !t.tui.ShouldEmitResizeEvent() {2855- resizeChan := make(chan os.Signal, 1)2856- notifyOnResize(resizeChan) // Non-portable2857- go func() {2858- for {2859- <-resizeChan2860- t.reqBox.Set(reqResize, nil)2861- }2862- }()2860+ resizeChan := make(chan os.Signal, 1)2861+ notifyOnResize(resizeChan) // Non-portable2862+ go func() {2863+ for {2864+ <-resizeChan2865+ t.reqBox.Set(reqResize, nil)2866+ }2867+ }()2868+ }2869 2870 t.mutex.Lock()2871 t.initFunc()2872 t.termSize = t.tui.Size()347 unmodified lines3220 barrier <- true3221 }3222 select {3223 case event = <-t.eventChan:3224+ if t.tui.ShouldEmitResizeEvent() {3225+ needBarrier = !event.Is(tui.Load, tui.Result, tui.Focus, tui.One, tui.Zero)3226+ } else {3218- needBarrier = !event.Is(tui.Load, tui.Result, tui.Focus, tui.One, tui.Zero, tui.Resize)3227+ needBarrier = !event.Is(tui.Load, tui.Result, tui.Focus, tui.One, tui.Zero, tui.Resize)3228+ }3229 case serverActions := <-t.serverInputChan:3230 event = tui.Invalid.AsEvent()3231 if t.listenAddr == nil || t.listenAddr.IsLocal() || t.listenUnsafe {3232 actions = serverActions965 unmodified lines