Skip to content

Commit eccf3b9

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 88a4d84 commit eccf3b9

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
@@ -368,8 +368,9 @@ def capture_pane(
368368
output = self.cmd(*cmd).stdout
369369

370370
def _trim(lines: list[str]) -> list[str]:
371+
# Match engine trimming: remove only empty strings, not whitespace-only
371372
trimmed = list(lines)
372-
while trimmed and trimmed[-1].strip() == "":
373+
while trimmed and trimmed[-1] == "":
373374
trimmed.pop()
374375
return trimmed
375376

0 commit comments

Comments
 (0)