mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-22 10:58:59 +00:00
parent
beb2de2dd9
commit
da752fc9a4
@ -817,7 +817,11 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
|
||||
}
|
||||
}
|
||||
|
||||
_, t.hasResizeActions = t.keymap[tui.Resize.AsEvent()]
|
||||
var resizeActions []*action
|
||||
resizeActions, t.hasResizeActions = t.keymap[tui.Resize.AsEvent()]
|
||||
if t.tui.ShouldEmitResizeEvent() {
|
||||
t.keymap[tui.Resize.AsEvent()] = append(toActions(actClearScreen), resizeActions...)
|
||||
}
|
||||
_, t.hasResultActions = t.keymap[tui.Result.AsEvent()]
|
||||
_, t.hasFocusActions = t.keymap[tui.Focus.AsEvent()]
|
||||
_, t.hasLoadActions = t.keymap[tui.Load.AsEvent()]
|
||||
@ -2852,14 +2856,16 @@ func (t *Terminal) Loop() {
|
||||
}
|
||||
}()
|
||||
|
||||
resizeChan := make(chan os.Signal, 1)
|
||||
notifyOnResize(resizeChan) // Non-portable
|
||||
go func() {
|
||||
for {
|
||||
<-resizeChan
|
||||
t.reqBox.Set(reqResize, nil)
|
||||
}
|
||||
}()
|
||||
if !t.tui.ShouldEmitResizeEvent() {
|
||||
resizeChan := make(chan os.Signal, 1)
|
||||
notifyOnResize(resizeChan) // Non-portable
|
||||
go func() {
|
||||
for {
|
||||
<-resizeChan
|
||||
t.reqBox.Set(reqResize, nil)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
t.mutex.Lock()
|
||||
t.initFunc()
|
||||
@ -3215,7 +3221,11 @@ func (t *Terminal) Loop() {
|
||||
}
|
||||
select {
|
||||
case event = <-t.eventChan:
|
||||
needBarrier = !event.Is(tui.Load, tui.Result, tui.Focus, tui.One, tui.Zero, tui.Resize)
|
||||
if t.tui.ShouldEmitResizeEvent() {
|
||||
needBarrier = !event.Is(tui.Load, tui.Result, tui.Focus, tui.One, tui.Zero)
|
||||
} else {
|
||||
needBarrier = !event.Is(tui.Load, tui.Result, tui.Focus, tui.One, tui.Zero, tui.Resize)
|
||||
}
|
||||
case serverActions := <-t.serverInputChan:
|
||||
event = tui.Invalid.AsEvent()
|
||||
if t.listenAddr == nil || t.listenAddr.IsLocal() || t.listenUnsafe {
|
||||
|
@ -36,6 +36,7 @@ func (r *FullscreenRenderer) Resume(bool, bool) {}
|
||||
func (r *FullscreenRenderer) PassThrough(string) {}
|
||||
func (r *FullscreenRenderer) Clear() {}
|
||||
func (r *FullscreenRenderer) NeedScrollbarRedraw() bool { return false }
|
||||
func (r *FullscreenRenderer) ShouldEmitResizeEvent() bool { return false }
|
||||
func (r *FullscreenRenderer) Refresh() {}
|
||||
func (r *FullscreenRenderer) Close() {}
|
||||
func (r *FullscreenRenderer) Size() TermSize { return TermSize{} }
|
||||
|
@ -694,6 +694,10 @@ func (r *LightRenderer) NeedScrollbarRedraw() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (r *LightRenderer) ShouldEmitResizeEvent() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (r *LightRenderer) RefreshWindows(windows []Window) {
|
||||
r.flush()
|
||||
}
|
||||
|
@ -202,6 +202,10 @@ func (r *FullscreenRenderer) NeedScrollbarRedraw() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (r *FullscreenRenderer) ShouldEmitResizeEvent() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (r *FullscreenRenderer) Refresh() {
|
||||
// noop
|
||||
}
|
||||
|
@ -494,6 +494,7 @@ type Renderer interface {
|
||||
Close()
|
||||
PassThrough(string)
|
||||
NeedScrollbarRedraw() bool
|
||||
ShouldEmitResizeEvent() bool
|
||||
|
||||
GetChar() Event
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user