Skip to content

Commit baddfcf

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 5f4ea02 commit baddfcf

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

365365
def _trim(lines: list[str]) -> list[str]:
366+
# Match engine trimming: remove only empty strings, not whitespace-only
366367
trimmed = list(lines)
367-
while trimmed and trimmed[-1].strip() == "":
368+
while trimmed and trimmed[-1] == "":
368369
trimmed.pop()
369370
return trimmed
370371

0 commit comments

Comments
 (0)