mercurial/color.py
branchstable
changeset 52442 b3214b7d2390
parent 51859 f4733654f144
--- a/mercurial/color.py	Thu Dec 05 13:48:22 2024 +0000
+++ b/mercurial/color.py	Thu Dec 05 20:46:21 2024 +0000
@@ -386,6 +386,9 @@
         ]
         start = b'\033[' + b';'.join(start) + b'm'
         stop = b'\033[' + pycompat.bytestr(activeeffects[b'none']) + b'm'
+        if ui._readlineprompt:
+            start = b'\001' + start + b'\001'
+            stop = b'\002' + stop + b'\002'
     return _mergeeffects(text, start, stop)
 
 
@@ -518,7 +521,8 @@
         else:
             origattr = csbi.wAttributes
             ansire = re.compile(
-                br'\033\[([^m]*)m([^\033]*)(.*)', re.MULTILINE | re.DOTALL
+                br'\001?\033\[([^m]*)m\002?([^\033]*)(.*)',
+                re.MULTILINE | re.DOTALL,
             )
 
     def win32print(ui, writefunc, text, **opts):