fix race while drawing ui in 'shell-pipe'
This commit is contained in:
parent
f6c99a7d46
commit
847c46421c
6
app.go
6
app.go
@ -244,8 +244,7 @@ func (app *app) runShell(s string, args []string, prefix string) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
buf = append(buf, b)
|
buf = append(buf, b)
|
||||||
app.ui.msg = string(buf)
|
app.ui.exprChan <- multiExpr{&callExpr{"echo", []string{string(buf)}}, 1}
|
||||||
app.ui.draw(app.nav)
|
|
||||||
if b == '\n' {
|
if b == '\n' {
|
||||||
buf = nil
|
buf = nil
|
||||||
}
|
}
|
||||||
@ -254,10 +253,9 @@ func (app *app) runShell(s string, args []string, prefix string) {
|
|||||||
if err := cmd.Wait(); err != nil {
|
if err := cmd.Wait(); err != nil {
|
||||||
log.Printf("running shell: %s", err)
|
log.Printf("running shell: %s", err)
|
||||||
}
|
}
|
||||||
app.nav.renew(app.ui.wins[0].h)
|
|
||||||
app.cmd = nil
|
app.cmd = nil
|
||||||
app.ui.cmdPrefix = ""
|
app.ui.cmdPrefix = ""
|
||||||
app.ui.draw(app.nav)
|
app.ui.exprChan <- multiExpr{&callExpr{"reload", nil}, 1}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
ui.go
3
ui.go
@ -415,6 +415,7 @@ type ui struct {
|
|||||||
msg string
|
msg string
|
||||||
regPrev *reg
|
regPrev *reg
|
||||||
dirPrev *dir
|
dirPrev *dir
|
||||||
|
exprChan chan multiExpr
|
||||||
keyChan chan string
|
keyChan chan string
|
||||||
evChan chan termbox.Event
|
evChan chan termbox.Event
|
||||||
menuBuf *bytes.Buffer
|
menuBuf *bytes.Buffer
|
||||||
@ -837,6 +838,8 @@ func (ui *ui) readEvent(ch chan<- multiExpr, ev termbox.Event) {
|
|||||||
func (ui *ui) readExpr() <-chan multiExpr {
|
func (ui *ui) readExpr() <-chan multiExpr {
|
||||||
ch := make(chan multiExpr)
|
ch := make(chan multiExpr)
|
||||||
|
|
||||||
|
ui.exprChan = ch
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
ch <- multiExpr{&callExpr{"redraw", nil}, 1}
|
ch <- multiExpr{&callExpr{"redraw", nil}, 1}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user