[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r110852: lisp/ansi-color.el (ansi-
From: |
Wolfgang Jenkner |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r110852: lisp/ansi-color.el (ansi-color-apply-sequence): Implement SGR codes 39 and 49. |
Date: |
Mon, 12 Nov 2012 18:12:33 +0100 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 110852
fixes bug: http://debbugs.gnu.org/12792
committer: Wolfgang Jenkner <address@hidden>
branch nick: emacs-24
timestamp: Mon 2012-11-12 18:12:33 +0100
message:
lisp/ansi-color.el (ansi-color-apply-sequence): Implement SGR codes 39 and 49.
This fixes bug#12792. Also, treat unimplemented parameters as 0,
thereby restoring the behavior of revisions prior to 109621.
modified:
lisp/ChangeLog
lisp/ansi-color.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-11-12 13:26:50 +0000
+++ b/lisp/ChangeLog 2012-11-12 17:12:33 +0000
@@ -1,3 +1,10 @@
+2012-11-12 Wolfgang Jenkner <address@hidden>
+
+ * ansi-color.el (ansi-color-apply-sequence): Implement SGR codes
+ 39 and 49. This fixes bug#12792. Also, treat unimplemented
+ parameters as 0, thereby restoring the behavior of revisions prior
+ to 109621.
+
2012-11-12 Fabián Ezequiel Gallina <address@hidden>
Fix end-of-defun misbehavior.
=== modified file 'lisp/ansi-color.el'
--- a/lisp/ansi-color.el 2012-09-25 04:13:02 +0000
+++ b/lisp/ansi-color.el 2012-11-12 17:12:33 +0000
@@ -534,34 +534,39 @@
ESCAPE-SEQ is an escape sequence parsed by `ansi-color-parse-sequence'.
-If the new codes resulting from ESCAPE-SEQ start with 0, then the
-old codes are discarded and the remaining new codes are
-processed. Otherwise, for each new code: if it is 21-25 or 27-29
-delete appropriate parameters from the list of codes; any other
-code that makes sense is added to the list of codes. Finally,
-the so changed list of codes is returned."
+For each new code, the following happens: if it is 1-7, add it to
+the list of codes; if it is 21-25 or 27, delete appropriate
+parameters from the list of codes; if it is 30-37 resp. 39, the
+foreground color code is replaced or added resp. deleted; if it
+is 40-47 resp. 49, the background color code is replaced or added
+resp. deleted; any other code is discarded together with the old
+codes. Finally, the so changed list of codes is returned."
(let ((new-codes (ansi-color-parse-sequence escape-sequence)))
(while new-codes
- (setq codes
- (let ((new (pop new-codes)))
- (cond ((zerop new)
- nil)
- ((or (<= new 20)
- (>= new 30))
- (if (memq new codes)
- codes
- (cons new codes)))
- ;; The standard says `21 doubly underlined' while
- ;; http://en.wikipedia.org/wiki/ANSI_escape_code claims
- ;; `21 Bright/Bold: off or Underline: Double'.
- ((/= new 26)
- (remq (- new 20)
- (cond ((= new 22)
- (remq 1 codes))
- ((= new 25)
- (remq 6 codes))
- (t codes))))
- (t codes)))))
+ (let* ((new (pop new-codes))
+ (q (/ new 10)))
+ (setq codes
+ (pcase q
+ (0 (unless (memq new '(0 8 9))
+ (cons new (remq new codes))))
+ (2 (unless (memq new '(20 26 28 29))
+ ;; The standard says `21 doubly underlined' while
+ ;; http://en.wikipedia.org/wiki/ANSI_escape_code claims
+ ;; `21 Bright/Bold: off or Underline: Double'.
+ (remq (- new 20) (pcase new
+ (22 (remq 1 codes))
+ (25 (remq 6 codes))
+ (_ codes)))))
+ ((or 3 4) (let ((r (mod new 10)))
+ (unless (= r 8)
+ (let (beg)
+ (while (and codes (/= q (/ (car codes) 10)))
+ (push (pop codes) beg))
+ (setq codes (nconc (nreverse beg) (cdr codes)))
+ (if (= r 9)
+ codes
+ (cons new codes))))))
+ (_ nil)))))
codes))
(defun ansi-color-make-color-map ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-24 r110852: lisp/ansi-color.el (ansi-color-apply-sequence): Implement SGR codes 39 and 49.,
Wolfgang Jenkner <=