GNU bug report logs -
#20084
comint-highlight-prompt overrides ANSI colors in 24.4
Previous Next
Reported by: Charles Tam <me <at> charlest.net>
Date: Wed, 11 Mar 2015 16:14:02 UTC
Severity: normal
Tags: confirmed, patch
Merged with 19843,
20658
Found in version 24.4
Fixed in version 25.1
Done: Wolfgang Jenkner <wjenkner <at> inode.at>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On Wed, Mar 11 2015, Glenn Morris wrote:
> Perhaps related to http://debbugs.gnu.org/14744, which I see was applied
> 2013-08-08, without any comment being made to the associated bug report, sigh.
Another symptom of the same bug introduced there is that copious
colourful output, as produced by, say, `ls /usr/bin', will have "white
spots".
I've been using something like the following patch for some time:
-- >8 --
Subject: [PATCH] Preserve face text properties in comint prompt.
* lisp/comint.el (comint-snapshot-last-prompt): Use
font-lock-prepend-text-property for comint-highlight-prompt.
(comint-output-filter): Remove only comint-highlight-prompt.
Thus, the original face text property of a prompt "candidate" (the
last line of an output chunk not ending with a newline) is
preserved. This amends the fixing of bug#14744. (Bug#20084)
---
lisp/comint.el | 38 ++++++++++++++++++++++++++++++--------
1 file changed, 30 insertions(+), 8 deletions(-)
diff --git a/lisp/comint.el b/lisp/comint.el
index b52d7fd..65b9c3c 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1926,10 +1926,10 @@ the start, the cdr to the end of the last prompt recognized.")
Freezes the `font-lock-face' text property in place."
(when comint-last-prompt
(with-silent-modifications
- (add-text-properties
+ (font-lock-prepend-text-property
(car comint-last-prompt)
(cdr comint-last-prompt)
- '(font-lock-face comint-highlight-prompt)))
+ 'font-lock-face 'comint-highlight-prompt))
;; Reset comint-last-prompt so later on comint-output-filter does
;; not remove the font-lock-face text property of the previous
;; (this) prompt.
@@ -2081,14 +2081,36 @@ Make backspaces delete the previous character."
(add-text-properties prompt-start (point)
'(read-only t front-sticky (read-only)))))
(when comint-last-prompt
- (remove-text-properties (car comint-last-prompt)
- (cdr comint-last-prompt)
- '(font-lock-face)))
+ (let ((start (car comint-last-prompt))
+ (limit (cdr comint-last-prompt))
+ face end)
+ (with-silent-modifications
+ (while
+ (progn
+ (setq end
+ (next-single-property-change start
+ 'font-lock-face
+ nil
+ limit))
+ (setq face (get-text-property start 'font-lock-face))
+ (put-text-property
+ start end 'font-lock-face
+ (if (and (consp face)
+ (not (or
+ (eq (car face) 'foreground-color)
+ (eq (car face) 'background-color)
+ (keywordp (car face)))))
+ (remove 'comint-highlight-prompt face)
+ (unless (eq face 'comint-highlight-prompt)
+ face)))
+ (< (setq start end) limit))))))
(setq comint-last-prompt
(cons (copy-marker prompt-start) (point-marker)))
- (add-text-properties prompt-start (point)
- '(rear-nonsticky t
- font-lock-face comint-highlight-prompt)))
+ (with-silent-modifications
+ (font-lock-prepend-text-property prompt-start (point)
+ 'font-lock-face
+ 'comint-highlight-prompt)
+ (add-text-properties prompt-start (point) '(rear-nonsticky t))))
(goto-char saved-point)))))))
(defun comint-preinput-scroll-to-bottom ()
--
2.3.0
This bug report was last modified 10 years and 3 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.