update demo

This commit is contained in:
Cheney 2015-09-26 01:01:20 +08:00
parent d07044cdb6
commit 75bbfa6d42
3 changed files with 11 additions and 2 deletions

View File

@ -134,7 +134,9 @@ func (o *opCompleter) HandleCompleteSelect(r rune) bool {
}
o.candicateChoise = tmpChoise
case CharBackward:
if o.op.buf.Len() > 0 {
o.nextCandicate(-1)
}
case CharPrev:
tmpChoise := o.candicateChoise - o.candicateColNum
if tmpChoise < 0 {
@ -146,6 +148,7 @@ func (o *opCompleter) HandleCompleteSelect(r rune) bool {
o.candicateChoise = tmpChoise
default:
next = false
o.ExitCompleteSelectMode()
}
if next {
o.CompleteRefresh()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

@ -66,7 +66,10 @@ func (o *Operation) ioloop() {
o.buf.Refresh()
switch r {
case CharInterrupt, CharEnter, CharCtrlJ:
case CharEnter, CharCtrlJ:
o.UpdateHistory(o.buf.Runes(), false)
fallthrough
case CharInterrupt:
o.t.KickRead()
fallthrough
case CharCancel:
@ -120,6 +123,9 @@ func (o *Operation) ioloop() {
break
}
if o.buf.Len() == 0 {
break
}
o.buf.Backspace()
if o.IsInCompleteMode() {
o.OnComplete()