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
|
o.candicateChoise = tmpChoise
|
||||||
case CharBackward:
|
case CharBackward:
|
||||||
|
if o.op.buf.Len() > 0 {
|
||||||
o.nextCandicate(-1)
|
o.nextCandicate(-1)
|
||||||
|
}
|
||||||
case CharPrev:
|
case CharPrev:
|
||||||
tmpChoise := o.candicateChoise - o.candicateColNum
|
tmpChoise := o.candicateChoise - o.candicateColNum
|
||||||
if tmpChoise < 0 {
|
if tmpChoise < 0 {
|
||||||
|
@ -146,6 +148,7 @@ func (o *opCompleter) HandleCompleteSelect(r rune) bool {
|
||||||
o.candicateChoise = tmpChoise
|
o.candicateChoise = tmpChoise
|
||||||
default:
|
default:
|
||||||
next = false
|
next = false
|
||||||
|
o.ExitCompleteSelectMode()
|
||||||
}
|
}
|
||||||
if next {
|
if next {
|
||||||
o.CompleteRefresh()
|
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()
|
o.buf.Refresh()
|
||||||
switch r {
|
switch r {
|
||||||
case CharInterrupt, CharEnter, CharCtrlJ:
|
case CharEnter, CharCtrlJ:
|
||||||
|
o.UpdateHistory(o.buf.Runes(), false)
|
||||||
|
fallthrough
|
||||||
|
case CharInterrupt:
|
||||||
o.t.KickRead()
|
o.t.KickRead()
|
||||||
fallthrough
|
fallthrough
|
||||||
case CharCancel:
|
case CharCancel:
|
||||||
|
@ -120,6 +123,9 @@ func (o *Operation) ioloop() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if o.buf.Len() == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
o.buf.Backspace()
|
o.buf.Backspace()
|
||||||
if o.IsInCompleteMode() {
|
if o.IsInCompleteMode() {
|
||||||
o.OnComplete()
|
o.OnComplete()
|
||||||
|
|
Loading…
Reference in New Issue