diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 146c6c9..8d5cbe1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-11-26 Leo + + * ansi-color.el (ansi-color-apply): Also eliminate unrecognized + ANSI sequences for remaining string. + 2010-10-03 Chong Yidong * minibuffer.el (completion--some, completion--do-completion) diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index 00162c9..40c0066 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el @@ -341,12 +341,15 @@ See `ansi-color-unfontify-region' for a way around this." (put-text-property start (length string) 'ansi-color t string) (put-text-property start (length string) 'face face string)) ;; save context, add the remainder of the string to the result - (let (fragment) - (if (string-match "\033" string start) + (let ((remaining (substring string start)) + fragment) + (while (string-match ansi-color-drop-regexp remaining) + (setq remaining (replace-match "" nil nil remaining))) + (if (string-match "\033" remaining) (let ((pos (match-beginning 0))) - (setq fragment (substring string pos)) - (push (substring string start pos) result)) - (push (substring string start) result)) + (setq fragment (substring remaining pos)) + (push (substring remaining 0 pos) result)) + (push remaining result)) (if (or face fragment) (setq ansi-color-context (list face fragment)) (setq ansi-color-context nil)))