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.buf.MoveToLineEnd()
|
||||
o.buf.WriteRune('\n')
|
||||
data := o.buf.Reset()
|
||||
data = data[:len(data)-1] // trim \n
|
||||
var data []rune
|
||||
if !o.cfg.UniqueEditLine {
|
||||
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.NewHistory(data)
|
||||
case CharBackward:
|
||||
|
|
|
@ -44,6 +44,8 @@ type Config struct {
|
|||
|
||||
MaskRune rune
|
||||
|
||||
UniqueEditLine bool
|
||||
|
||||
// private fields
|
||||
inited bool
|
||||
opHistory *opHistory
|
||||
|
|
Loading…
Reference in New Issue