mirror of https://github.com/chzyer/readline.git
fixes: flush chars if got io.EOF without '\n' (#58)
This commit is contained in:
parent
03625fbce3
commit
b411b0f4b2
|
@ -97,11 +97,18 @@ func (o *Operation) ioloop() {
|
||||||
keepInCompleteMode := false
|
keepInCompleteMode := false
|
||||||
r := o.t.ReadRune()
|
r := o.t.ReadRune()
|
||||||
if r == 0 { // io.EOF
|
if r == 0 { // io.EOF
|
||||||
|
if o.buf.Len() == 0 {
|
||||||
o.buf.Clean()
|
o.buf.Clean()
|
||||||
select {
|
select {
|
||||||
case o.errchan <- io.EOF:
|
case o.errchan <- io.EOF:
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
} else {
|
||||||
|
// if stdin got io.EOF and there is something left in buffer,
|
||||||
|
// let's flush them by sending CharEnter.
|
||||||
|
// And we will got io.EOF int next loop.
|
||||||
|
r = CharEnter
|
||||||
|
}
|
||||||
}
|
}
|
||||||
isUpdateHistory := true
|
isUpdateHistory := true
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue