From 3d202e8148faf3b960219201957bb11504e1216c Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Sun, 13 Jul 2025 17:27:48 -0700 Subject: [PATCH] Handle CR+LF: consume LF after CR, to avoid empty extra lines in dos new line content --- terminal.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/terminal.go b/terminal.go index 1d7c97f..bddb2e2 100644 --- a/terminal.go +++ b/terminal.go @@ -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 {