replace 'redraw' commands with 'draw'

This commit is contained in:
Gokcehan 2018-04-12 21:54:40 +03:00
parent 4d3437a198
commit c1fc79b6ae

16
ui.go
View File

@ -740,7 +740,7 @@ func readCmdEvent(ch chan<- expr, ev termbox.Event) {
} }
func (ui *ui) readEvent(ch chan<- expr, ev termbox.Event) { func (ui *ui) readEvent(ch chan<- expr, ev termbox.Event) {
redraw := &callExpr{"redraw", nil, 1} draw := &callExpr{"draw", nil, 1}
count := 1 count := 1
switch ev.Type { switch ev.Type {
@ -759,7 +759,7 @@ func (ui *ui) readEvent(ch chan<- expr, ev termbox.Event) {
} else { } else {
val := gKeyVal[ev.Key] val := gKeyVal[ev.Key]
if string(val) == "<esc>" { if string(val) == "<esc>" {
ch <- redraw ch <- draw
ui.keyAcc = nil ui.keyAcc = nil
ui.keyCount = nil ui.keyCount = nil
} }
@ -767,7 +767,7 @@ func (ui *ui) readEvent(ch chan<- expr, ev termbox.Event) {
} }
if len(ui.keyAcc) == 0 { if len(ui.keyAcc) == 0 {
ch <- redraw ch <- draw
break break
} }
@ -776,7 +776,7 @@ func (ui *ui) readEvent(ch chan<- expr, ev termbox.Event) {
switch len(binds) { switch len(binds) {
case 0: case 0:
ui.printf("unknown mapping: %s", string(ui.keyAcc)) ui.printf("unknown mapping: %s", string(ui.keyAcc))
ch <- redraw ch <- draw
ui.keyAcc = nil ui.keyAcc = nil
ui.keyCount = nil ui.keyCount = nil
ui.menuBuf = nil ui.menuBuf = nil
@ -801,7 +801,7 @@ func (ui *ui) readEvent(ch chan<- expr, ev termbox.Event) {
ui.menuBuf = nil ui.menuBuf = nil
} else { } else {
ui.menuBuf = listBinds(binds) ui.menuBuf = listBinds(binds)
ch <- redraw ch <- draw
} }
default: default:
if ok { if ok {
@ -825,11 +825,11 @@ func (ui *ui) readEvent(ch chan<- expr, ev termbox.Event) {
ui.menuBuf = nil ui.menuBuf = nil
} else { } else {
ui.menuBuf = listBinds(binds) ui.menuBuf = listBinds(binds)
ch <- redraw ch <- draw
} }
} }
case termbox.EventResize: case termbox.EventResize:
ch <- redraw ch <- draw
default: default:
// TODO: handle other events // TODO: handle other events
} }
@ -844,7 +844,7 @@ func (ui *ui) readExpr() <-chan expr {
ui.exprChan = ch ui.exprChan = ch
go func() { go func() {
ch <- &callExpr{"redraw", nil, 1} ch <- &callExpr{"draw", nil, 1}
for { for {
ev := ui.pollEvent() ev := ui.pollEvent()