From 0cf26df9aec994dfc61392e98b9034fe7133fb7f Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Wed, 16 Jul 2025 11:00:25 -0700 Subject: [PATCH] Clarify limitation/corner case of CRLF in test --- terminal_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/terminal_test.go b/terminal_test.go index 7633003..5d35cc5 100644 --- a/terminal_test.go +++ b/terminal_test.go @@ -313,7 +313,11 @@ func TestRender(t *testing.T) { func TestCRLF(t *testing.T) { c := &MockTerminal{ toSend: []byte("line1\rline2\r\nline3\n"), - // bytesPerRead 0 means read all at once - CR+LF need to be in same read which is what terminals would do. + // bytesPerRead 0 in this test means read all at once + // CR+LF need to be in same read for ReadLine to not produce an extra empty line + // which is what terminals do for reasonably small paste. if way many lines are pasted + // and going over say 1k-16k buffer, readline current implementation will possibly generate 1 + // extra empty line, if the CR is in chunk1 and LF in chunk2 (and that's fine). } ss := NewTerminal(c, "> ")