mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-22 19:09:00 +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.hasResultActions = t.keymap[tui.Result.AsEvent()]
|
||||||
_, t.hasFocusActions = t.keymap[tui.Focus.AsEvent()]
|
_, t.hasFocusActions = t.keymap[tui.Focus.AsEvent()]
|
||||||
_, t.hasLoadActions = t.keymap[tui.Load.AsEvent()]
|
_, t.hasLoadActions = t.keymap[tui.Load.AsEvent()]
|
||||||
@ -2852,14 +2856,16 @@ func (t *Terminal) Loop() {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
resizeChan := make(chan os.Signal, 1)
|
if !t.tui.ShouldEmitResizeEvent() {
|
||||||
notifyOnResize(resizeChan) // Non-portable
|
resizeChan := make(chan os.Signal, 1)
|
||||||
go func() {
|
notifyOnResize(resizeChan) // Non-portable
|
||||||
for {
|
go func() {
|
||||||
<-resizeChan
|
for {
|
||||||
t.reqBox.Set(reqResize, nil)
|
<-resizeChan
|
||||||
}
|
t.reqBox.Set(reqResize, nil)
|
||||||
}()
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
t.mutex.Lock()
|
t.mutex.Lock()
|
||||||
t.initFunc()
|
t.initFunc()
|
||||||
@ -3215,7 +3221,11 @@ func (t *Terminal) Loop() {
|
|||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
case event = <-t.eventChan:
|
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:
|
case serverActions := <-t.serverInputChan:
|
||||||
event = tui.Invalid.AsEvent()
|
event = tui.Invalid.AsEvent()
|
||||||
if t.listenAddr == nil || t.listenAddr.IsLocal() || t.listenUnsafe {
|
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) PassThrough(string) {}
|
||||||
func (r *FullscreenRenderer) Clear() {}
|
func (r *FullscreenRenderer) Clear() {}
|
||||||
func (r *FullscreenRenderer) NeedScrollbarRedraw() bool { return false }
|
func (r *FullscreenRenderer) NeedScrollbarRedraw() bool { return false }
|
||||||
|
func (r *FullscreenRenderer) ShouldEmitResizeEvent() bool { return false }
|
||||||
func (r *FullscreenRenderer) Refresh() {}
|
func (r *FullscreenRenderer) Refresh() {}
|
||||||
func (r *FullscreenRenderer) Close() {}
|
func (r *FullscreenRenderer) Close() {}
|
||||||
func (r *FullscreenRenderer) Size() TermSize { return TermSize{} }
|
func (r *FullscreenRenderer) Size() TermSize { return TermSize{} }
|
||||||
|
@ -694,6 +694,10 @@ func (r *LightRenderer) NeedScrollbarRedraw() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *LightRenderer) ShouldEmitResizeEvent() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (r *LightRenderer) RefreshWindows(windows []Window) {
|
func (r *LightRenderer) RefreshWindows(windows []Window) {
|
||||||
r.flush()
|
r.flush()
|
||||||
}
|
}
|
||||||
|
@ -202,6 +202,10 @@ func (r *FullscreenRenderer) NeedScrollbarRedraw() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *FullscreenRenderer) ShouldEmitResizeEvent() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func (r *FullscreenRenderer) Refresh() {
|
func (r *FullscreenRenderer) Refresh() {
|
||||||
// noop
|
// noop
|
||||||
}
|
}
|
||||||
|
@ -494,6 +494,7 @@ type Renderer interface {
|
|||||||
Close()
|
Close()
|
||||||
PassThrough(string)
|
PassThrough(string)
|
||||||
NeedScrollbarRedraw() bool
|
NeedScrollbarRedraw() bool
|
||||||
|
ShouldEmitResizeEvent() bool
|
||||||
|
|
||||||
GetChar() Event
|
GetChar() Event
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user