forked from mirror/readline
#26 support unique edit line
This commit is contained in:
parent
f20f365652
commit
a0730873ad
12
operation.go
12
operation.go
|
@ -174,9 +174,15 @@ func (o *Operation) ioloop() {
|
||||||
o.ExitSearchMode(false)
|
o.ExitSearchMode(false)
|
||||||
}
|
}
|
||||||
o.buf.MoveToLineEnd()
|
o.buf.MoveToLineEnd()
|
||||||
o.buf.WriteRune('\n')
|
var data []rune
|
||||||
data := o.buf.Reset()
|
if !o.cfg.UniqueEditLine {
|
||||||
data = data[:len(data)-1] // trim \n
|
o.buf.WriteRune('\n')
|
||||||
|
data = o.buf.Reset()
|
||||||
|
data = data[:len(data)-1] // trim \n
|
||||||
|
} else {
|
||||||
|
o.buf.Clean()
|
||||||
|
data = o.buf.Reset()
|
||||||
|
}
|
||||||
o.outchan <- data
|
o.outchan <- data
|
||||||
o.NewHistory(data)
|
o.NewHistory(data)
|
||||||
case CharBackward:
|
case CharBackward:
|
||||||
|
|
|
@ -44,6 +44,8 @@ type Config struct {
|
||||||
|
|
||||||
MaskRune rune
|
MaskRune rune
|
||||||
|
|
||||||
|
UniqueEditLine bool
|
||||||
|
|
||||||
// private fields
|
// private fields
|
||||||
inited bool
|
inited bool
|
||||||
opHistory *opHistory
|
opHistory *opHistory
|
||||||
|
|
Loading…
Reference in New Issue