#26 support unique edit line

This commit is contained in:
Cheney 2016-02-15 10:05:39 +08:00
parent f20f365652
commit a0730873ad
2 changed files with 11 additions and 3 deletions

View File

@ -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:

View File

@ -44,6 +44,8 @@ type Config struct {
MaskRune rune
UniqueEditLine bool
// private fields
inited bool
opHistory *opHistory