Skip to content

Commit 9de78b1

Browse files
committed
pane(fix): Unify capture_pane trimming with engine behavior
Change _trim() in capture_pane() from `line.strip() == ""` to `line == ""` to match the trimming behavior in subprocess_engine.py and control_protocol.py. The previous `.strip()` approach was too aggressive, removing lines that contain only whitespace (like a shell prompt `$`), causing mismatches between subprocess and control mode output.
1 parent 6914a71 commit 9de78b1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libtmux/pane.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,9 @@ def capture_pane(
353353
output = self.cmd(*cmd).stdout
354354

355355
def _trim(lines: list[str]) -> list[str]:
356+
# Match engine trimming: remove only empty strings, not whitespace-only
356357
trimmed = list(lines)
357-
while trimmed and trimmed[-1].strip() == "":
358+
while trimmed and trimmed[-1] == "":
358359
trimmed.pop()
359360
return trimmed
360361

0 commit comments

Comments
 (0)