mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-25 06:07:42 +00:00
Fix CTRL-Z handling
Fix #3802 This fixes `xterm -e fzf` hangs on CTRL-Z * Replace SIGSTOP with SIGTSTP * Do not rely on SIGCONT
This commit is contained in:
parent
a09c6e991a
commit
0eee95af57
@ -854,7 +854,6 @@ func NewTerminal(opts *Options, eventBox *util.EventBox, executor *util.Executor
|
|||||||
mutex: sync.Mutex{},
|
mutex: sync.Mutex{},
|
||||||
uiMutex: sync.Mutex{},
|
uiMutex: sync.Mutex{},
|
||||||
suppress: true,
|
suppress: true,
|
||||||
sigstop: false,
|
|
||||||
slab: util.MakeSlab(slab16Size, slab32Size),
|
slab: util.MakeSlab(slab16Size, slab32Size),
|
||||||
theme: opts.Theme,
|
theme: opts.Theme,
|
||||||
startChan: make(chan fitpad, 1),
|
startChan: make(chan fitpad, 1),
|
||||||
@ -3437,19 +3436,6 @@ func (t *Terminal) Loop() error {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
contChan := make(chan os.Signal, 1)
|
|
||||||
notifyOnCont(contChan)
|
|
||||||
go func() {
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
return
|
|
||||||
case <-contChan:
|
|
||||||
t.reqBox.Set(reqReinit, nil)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
if !t.tui.ShouldEmitResizeEvent() {
|
if !t.tui.ShouldEmitResizeEvent() {
|
||||||
resizeChan := make(chan os.Signal, 1)
|
resizeChan := make(chan os.Signal, 1)
|
||||||
notifyOnResize(resizeChan) // Non-portable
|
notifyOnResize(resizeChan) // Non-portable
|
||||||
@ -3787,7 +3773,7 @@ func (t *Terminal) Loop() error {
|
|||||||
case reqRedrawPreviewLabel:
|
case reqRedrawPreviewLabel:
|
||||||
t.printLabel(t.pborder, t.previewLabel, t.previewLabelOpts, t.previewLabelLen, t.previewOpts.border, true)
|
t.printLabel(t.pborder, t.previewLabel, t.previewLabelOpts, t.previewLabelLen, t.previewOpts.border, true)
|
||||||
case reqReinit:
|
case reqReinit:
|
||||||
t.tui.Resume(t.fullscreen, t.sigstop)
|
t.tui.Resume(t.fullscreen, true)
|
||||||
t.fullRedraw()
|
t.fullRedraw()
|
||||||
case reqResize, reqFullRedraw:
|
case reqResize, reqFullRedraw:
|
||||||
if req == reqResize {
|
if req == reqResize {
|
||||||
@ -4527,11 +4513,11 @@ func (t *Terminal) Loop() error {
|
|||||||
case actSigStop:
|
case actSigStop:
|
||||||
p, err := os.FindProcess(os.Getpid())
|
p, err := os.FindProcess(os.Getpid())
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.sigstop = true
|
|
||||||
t.tui.Clear()
|
t.tui.Clear()
|
||||||
t.tui.Pause(t.fullscreen)
|
t.tui.Pause(t.fullscreen)
|
||||||
notifyStop(p)
|
notifyStop(p)
|
||||||
t.mutex.Unlock()
|
t.mutex.Unlock()
|
||||||
|
t.reqBox.Set(reqReinit, nil)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
case actMouse:
|
case actMouse:
|
||||||
|
@ -20,9 +20,5 @@ func notifyStop(p *os.Process) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
pid = pgid * -1
|
pid = pgid * -1
|
||||||
}
|
}
|
||||||
unix.Kill(pid, syscall.SIGSTOP)
|
unix.Kill(pid, syscall.SIGTSTP)
|
||||||
}
|
|
||||||
|
|
||||||
func notifyOnCont(resizeChan chan<- os.Signal) {
|
|
||||||
signal.Notify(resizeChan, syscall.SIGCONT)
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,3 @@ func notifyOnResize(resizeChan chan<- os.Signal) {
|
|||||||
func notifyStop(p *os.Process) {
|
func notifyStop(p *os.Process) {
|
||||||
// NOOP
|
// NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
func notifyOnCont(resizeChan chan<- os.Signal) {
|
|
||||||
// NOOP
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user