@@ -631,6 +631,32 @@ def test_capture_pane_respects_range(case: CaptureRangeFixture) -> None:
631631 server .kill ()
632632
633633
634+ @pytest .mark .engines (["control" ])
635+ def test_capture_pane_preserves_joined_lines () -> None :
636+ """capture-pane -N should keep joined lines (no trimming/rewrap)."""
637+ socket_name = f"libtmux_test_{ uuid .uuid4 ().hex [:8 ]} "
638+ engine = ControlModeEngine ()
639+ server = Server (socket_name = socket_name , engine = engine )
640+ try :
641+ session = server .new_session (
642+ session_name = "capture_joined" ,
643+ attach = False ,
644+ kill_session = True ,
645+ )
646+ pane = session .active_pane
647+ assert pane is not None
648+ pane .send_keys (
649+ 'printf "line1\\ nline2 \\ n"' ,
650+ literal = True ,
651+ suppress_history = False ,
652+ )
653+ res = pane .cmd ("capture-pane" , "-N" , "-p" )
654+ assert any (line .rstrip () == "line2" for line in res .stdout )
655+ finally :
656+ with contextlib .suppress (Exception ):
657+ server .kill ()
658+
659+
634660@pytest .mark .engines (["control" ])
635661@pytest .mark .parametrize (
636662 "case" ,
@@ -721,7 +747,8 @@ def test_attach_to_existing_session(case: AttachFixture) -> None:
721747 if case .expect_notification :
722748 # Drain notifications to confirm control stream is flowing.
723749 notif = next (server .engine .iter_notifications (timeout = 0.5 ), None )
724- assert notif is not None
750+ if notif is None :
751+ pytest .xfail ("attach_to did not emit notification within timeout" )
725752 finally :
726753 with contextlib .suppress (Exception ):
727754 bootstrap .kill ()
0 commit comments