diff --git a/operation.go b/operation.go index 0f93282..e114e5f 100644 --- a/operation.go +++ b/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: diff --git a/readline.go b/readline.go index 6a66870..6ac68b9 100644 --- a/readline.go +++ b/readline.go @@ -44,6 +44,8 @@ type Config struct { MaskRune rune + UniqueEditLine bool + // private fields inited bool opHistory *opHistory