forked from mirror/readline
update demo
This commit is contained in:
parent
d07044cdb6
commit
75bbfa6d42
|
@ -134,7 +134,9 @@ func (o *opCompleter) HandleCompleteSelect(r rune) bool {
|
|||
}
|
||||
o.candicateChoise = tmpChoise
|
||||
case CharBackward:
|
||||
o.nextCandicate(-1)
|
||||
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()
|
||||
|
|
BIN
example/demo.gif
BIN
example/demo.gif
Binary file not shown.
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.8 MiB |
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue