Handle CR+LF: consume LF after CR, to avoid empty extra lines in dos new line content

This commit is contained in:
Laurent Demailly
2025-07-13 17:27:48 -07:00
parent bc5cb00b38
commit 3d202e8148

View File

@@ -813,6 +813,10 @@ func (t *Terminal) readLine() (line string, err error) {
if !t.pasteActive {
lineIsPasted = false
}
// If we have CR, consume LF if present (CRLF sequence) to avoid returning an extra empty line.
if key == keyEnter && len(rest) > 0 && rest[0] == keyLF {
rest = rest[1:]
}
line, lineOk = t.handleKey(key)
}
if len(rest) > 0 {