fix(tmux): drop a leading blank line made of spaces, not only line breaks

`"  \nfix it\r"` still pasted a blank first line, because the leading strip
only matched `\n`. /^\s*\n/ drops everything up to the last leading line
break, mirroring the trimEnd() at the other end, and the first real line
keeps its indentation. The test row fails with the old pattern.

Co-Authored-By: Christian Haberl <116439789+christianhaberl@users.noreply.github.com>
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
committed 2026-10-21 23:31:06 +02:00
1 parent 2fe9105bab
commit 9a00c2feaa
2 files changed
+13 -3

No files matched your search

+5
View File
@@ -261,6 +261,11 @@ describe('sendInput line breaks', () => {
await multi.sendInput('s1', '\r\n\r\none\ntwo\r');
expect(bufferText(multi.ran[0])).toBe('one\ntwo');
// A blank first line made of spaces is dropped too; the first real line keeps its indentation.
const spaced = managerWithSession();
await spaced.sendInput('s1', ' \n\t\n fix it\nnow\r');
expect(bufferText(spaced.ran[0])).toBe(' fix it\nnow');
// Without an Enter, what is left is one line, so it is typed like any other.
const typed = managerWithSession();
await typed.sendInput('s1', '\n\njust type');