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
|
||||
}
|
||||
buf = append(buf, b)
|
||||
app.ui.msg = string(buf)
|
||||
app.ui.draw(app.nav)
|
||||
app.ui.exprChan <- multiExpr{&callExpr{"echo", []string{string(buf)}}, 1}
|
||||
if b == '\n' {
|
||||
buf = nil
|
||||
}
|
||||
@ -254,10 +253,9 @@ func (app *app) runShell(s string, args []string, prefix string) {
|
||||
if err := cmd.Wait(); err != nil {
|
||||
log.Printf("running shell: %s", err)
|
||||
}
|
||||
app.nav.renew(app.ui.wins[0].h)
|
||||
app.cmd = nil
|
||||
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
|
||||
regPrev *reg
|
||||
dirPrev *dir
|
||||
exprChan chan multiExpr
|
||||
keyChan chan string
|
||||
evChan chan termbox.Event
|
||||
menuBuf *bytes.Buffer
|
||||
@ -837,6 +838,8 @@ func (ui *ui) readEvent(ch chan<- multiExpr, ev termbox.Event) {
|
||||
func (ui *ui) readExpr() <-chan multiExpr {
|
||||
ch := make(chan multiExpr)
|
||||
|
||||
ui.exprChan = ch
|
||||
|
||||
go func() {
|
||||
ch <- multiExpr{&callExpr{"redraw", nil}, 1}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user