From bb2112a5c4d7cac7f5ca5e4a9d0c5e0f14806792 Mon Sep 17 00:00:00 2001 From: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> Date: Mon, 5 Jan 2026 22:46:08 +0100 Subject: [PATCH] gh-143394: filter for turning off automatic margins in test_no_newline (GH-143433) (cherry picked from commit 04ace41fe2cf648be433503d0c336b154ad63a3b) Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> --- Lib/test/test_pyrepl/test_pyrepl.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py index b1c6e5c99696da..9c365007bebcc9 100644 --- a/Lib/test/test_pyrepl/test_pyrepl.py +++ b/Lib/test/test_pyrepl/test_pyrepl.py @@ -1981,6 +1981,17 @@ def test_no_newline(self): safe_patterns.append(r'\x1b\[\?25[hl]') # cursor visibility safe_patterns.append(r'\x1b\[\?12[hl]') # cursor blinking + # rmam / smam - automatic margins + rmam = ti.get("rmam") + smam = ti.get("smam") + if rmam: + safe_patterns.append(re.escape(rmam.decode("ascii"))) + 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 safe_patterns.append(r'\x1b\[\?12[hl]') # cursor blinking (may be separate)