show command counts in the ruler

Related #66
This commit is contained in:
Gokcehan 2018-04-12 19:14:50 +03:00
parent 03619c3cbb
commit 68a23a10e1

20
ui.go
View File

@ -586,8 +586,9 @@ func (ui *ui) drawStatLine(nav *nav) {
tot := len(currDir.fi) tot := len(currDir.fi)
ind := min(currDir.ind+1, tot) ind := min(currDir.ind+1, tot)
acc := string(ui.keyCount) + string(ui.keyAcc)
ruler := fmt.Sprintf("%d/%d", ind, tot) ruler := fmt.Sprintf("%s %d/%d", acc, ind, tot)
ui.msgWin.printRight(0, fg, bg, ruler) ui.msgWin.printRight(0, fg, bg, ruler)
} }
@ -765,6 +766,11 @@ func (ui *ui) readEvent(ch chan<- expr, ev termbox.Event) {
ui.keyAcc = append(ui.keyAcc, val...) ui.keyAcc = append(ui.keyAcc, val...)
} }
if len(ui.keyAcc) == 0 {
ch <- redraw
break
}
binds, ok := findBinds(gOpts.keys, string(ui.keyAcc)) binds, ok := findBinds(gOpts.keys, string(ui.keyAcc))
switch len(binds) { switch len(binds) {
@ -792,12 +798,10 @@ func (ui *ui) readEvent(ch chan<- expr, ev termbox.Event) {
ch <- expr ch <- expr
ui.keyAcc = nil ui.keyAcc = nil
ui.keyCount = nil ui.keyCount = nil
} ui.menuBuf = nil
if len(ui.keyAcc) > 0 { } else {
ui.menuBuf = listBinds(binds) ui.menuBuf = listBinds(binds)
ch <- redraw ch <- redraw
} else if ui.menuBuf != nil {
ui.menuBuf = nil
} }
default: default:
if ok { if ok {
@ -818,12 +822,10 @@ func (ui *ui) readEvent(ch chan<- expr, ev termbox.Event) {
ch <- expr ch <- expr
ui.keyAcc = nil ui.keyAcc = nil
ui.keyCount = nil ui.keyCount = nil
} ui.menuBuf = nil
if len(ui.keyAcc) > 0 { } else {
ui.menuBuf = listBinds(binds) ui.menuBuf = listBinds(binds)
ch <- redraw ch <- redraw
} else {
ui.menuBuf = nil
} }
} }
case termbox.EventResize: case termbox.EventResize: