mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-15 20:23:50 -07:00
Revert "Add GET endpoints for getting the state of the finder"
This reverts commit 750b2a6313
.
This can cause a deadlock if the endpoints are accessed in the core event
loop via execute action.
fzf --listen 6266 --bind 'space:execute:curl localhost:6266'
Technically, there's no reason to use the API because the information is
already available via `{}` and `{q}`, but I'd like to completely remove
the risk of misuse.
This commit is contained in:
@@ -201,8 +201,7 @@ type Terminal struct {
|
||||
sigstop bool
|
||||
startChan chan fitpad
|
||||
killChan chan int
|
||||
serverRequestChan chan []*action
|
||||
serverResponseChan chan string
|
||||
serverChan chan []*action
|
||||
slab *util.Slab
|
||||
theme *tui.ColorTheme
|
||||
tui tui.Renderer
|
||||
@@ -277,7 +276,6 @@ const (
|
||||
actDeleteChar
|
||||
actDeleteCharEOF
|
||||
actEndOfLine
|
||||
actEvaluate
|
||||
actForwardChar
|
||||
actForwardWord
|
||||
actKillLine
|
||||
@@ -601,8 +599,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
|
||||
theme: opts.Theme,
|
||||
startChan: make(chan fitpad, 1),
|
||||
killChan: make(chan int),
|
||||
serverRequestChan: make(chan []*action),
|
||||
serverResponseChan: make(chan string),
|
||||
serverChan: make(chan []*action),
|
||||
tui: renderer,
|
||||
initFunc: func() { renderer.Init() },
|
||||
executing: util.NewAtomicBool(false)}
|
||||
@@ -624,7 +621,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
|
||||
t.separator, t.separatorLen = t.ansiLabelPrinter(bar, &tui.ColSeparator, true)
|
||||
}
|
||||
|
||||
if err := startHttpServer(t.listenPort, t.serverRequestChan, t.serverResponseChan); err != nil {
|
||||
if err := startHttpServer(t.listenPort, t.serverChan); err != nil {
|
||||
errorExit(err.Error())
|
||||
}
|
||||
|
||||
@@ -2534,7 +2531,7 @@ func (t *Terminal) Loop() {
|
||||
select {
|
||||
case event = <-eventChan:
|
||||
needBarrier = true
|
||||
case actions = <-t.serverRequestChan:
|
||||
case actions = <-t.serverChan:
|
||||
event = tui.Invalid.AsEvent()
|
||||
needBarrier = false
|
||||
}
|
||||
@@ -2617,15 +2614,6 @@ func (t *Terminal) Loop() {
|
||||
t.executeCommand(a.a, false, a.t == actExecuteSilent)
|
||||
case actExecuteMulti:
|
||||
t.executeCommand(a.a, true, false)
|
||||
case actEvaluate:
|
||||
response := ""
|
||||
switch a.a {
|
||||
case "", "current":
|
||||
response = t.currentItem().AsString(t.ansi)
|
||||
case "query":
|
||||
response = string(t.input)
|
||||
}
|
||||
t.serverResponseChan <- response
|
||||
case actInvalid:
|
||||
t.mutex.Unlock()
|
||||
return false
|
||||
|
Reference in New Issue
Block a user