From d16487747618d52d1b8cdef81e10f97096c79332 Mon Sep 17 00:00:00 2001 From: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> Date: Mon, 5 Jan 2026 12:14:09 +0100 Subject: [PATCH 1/2] filter for turning off automatic margins in test_no_newline --- Lib/test/test_pyrepl/test_pyrepl.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py index 6cf87522af2bc3..fe7ccb37894070 100644 --- a/Lib/test/test_pyrepl/test_pyrepl.py +++ b/Lib/test/test_pyrepl/test_pyrepl.py @@ -1899,6 +1899,13 @@ def test_no_newline(self): safe_patterns.append(r'\x1b\[\?25[hl]') # cursor visibility safe_patterns.append(r'\x1b\[\?12[hl]') # cursor blinking + # rmam - turn off automatic margins + rmam = ti.get("rmam") + if rmam: + safe_patterns.append(re.escape(rmam.decode("ascii"))) + else: + safe_patterns.append(r'\x1b\[\?7l') + # Modern extensions not in standard terminfo - always use patterns safe_patterns.append(r'\x1b\[\?2004[hl]') # bracketed paste mode safe_patterns.append(r'\x1b\[\?12[hl]') # cursor blinking (may be separate) From 5017cc21dd3df4ef81a62c744ffaac8e9866866e Mon Sep 17 00:00:00 2001 From: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> Date: Mon, 5 Jan 2026 15:12:25 +0100 Subject: [PATCH 2/2] add smam --- Lib/test/test_pyrepl/test_pyrepl.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py index fe7ccb37894070..18f334d46f1654 100644 --- a/Lib/test/test_pyrepl/test_pyrepl.py +++ b/Lib/test/test_pyrepl/test_pyrepl.py @@ -1899,12 +1899,16 @@ def test_no_newline(self): safe_patterns.append(r'\x1b\[\?25[hl]') # cursor visibility safe_patterns.append(r'\x1b\[\?12[hl]') # cursor blinking - # rmam - turn off automatic margins + # rmam / smam - automatic margins rmam = ti.get("rmam") + smam = ti.get("smam") if rmam: safe_patterns.append(re.escape(rmam.decode("ascii"))) - else: - safe_patterns.append(r'\x1b\[\?7l') + if smam: + safe_patterns.append(re.escape(smam.decode("ascii"))) + if not rmam and not smam: + safe_patterns.append(r'\x1b\[\?7l') # turn off automatic margins + safe_patterns.append(r'\x1b\[\?7h') # turn on automatic margins # Modern extensions not in standard terminfo - always use patterns safe_patterns.append(r'\x1b\[\?2004[hl]') # bracketed paste mode