changeset 102797:1c872d7c3c04

(ansi-color-get-face): Use ansi-color-parameter-regexp to match parameters. (ansi-color-regexp): Include final `m' in first group.
author Andreas Schwab <schwab@linux-m68k.org>
date Mon, 30 Mar 2009 15:35:52 +0000
parents 2a9a6088fd9f
children 6f4fe5de62c8
files lisp/ChangeLog lisp/ansi-color.el
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Mar 30 15:07:08 2009 +0000
+++ b/lisp/ChangeLog	Mon Mar 30 15:35:52 2009 +0000
@@ -1,3 +1,9 @@
+2009-03-30  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* ansi-color.el (ansi-color-get-face): Use
+	ansi-color-parameter-regexp to match parameters.
+	(ansi-color-regexp): Include final `m' in first group.
+
 2009-03-30  Jason Rumney  <jasonr@gnu.org>
 
 	* files.el (locate-dominating-stop-dir-regexp): Stop searching
--- a/lisp/ansi-color.el	Mon Mar 30 15:07:08 2009 +0000
+++ b/lisp/ansi-color.el	Mon Mar 30 15:35:52 2009 +0000
@@ -147,7 +147,7 @@
   :initialize 'custom-initialize-default
   :group 'ansi-colors)
 
-(defconst ansi-color-regexp "\033\\[\\([0-9;]*\\)m"
+(defconst ansi-color-regexp "\033\\[\\([0-9;]*m\\)"
   "Regexp that matches SGR control sequences.")
 
 (defconst ansi-color-parameter-regexp "\\([0-9]*\\)[m;]"
@@ -614,13 +614,12 @@
 
 ESCAPE-SEQ is a SGR control sequences such as \\033[34m.  The parameter
 34 is used by `ansi-color-get-face-1' to return a face definition."
-  (let ((ansi-color-r "[0-9][0-9]?")
-        (i 0)
+  (let ((i 0)
         f val)
-    (while (string-match ansi-color-r escape-seq i)
+    (while (string-match ansi-color-parameter-regexp escape-seq i)
       (setq i (match-end 0)
 	    val (ansi-color-get-face-1
-		 (string-to-number (match-string 0 escape-seq) 10)))
+		 (string-to-number (match-string 1 escape-seq) 10)))
       (cond ((not val))
 	    ((eq val 'default)
 	     (setq f (list val)))