summaryrefslogtreecommitdiff
path: root/lisp/ansi-color.el
diff options
context:
space:
mode:
authorJim Blandy <jimb@red-bean.com>2020-10-20 13:09:16 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-10-20 13:09:16 +0200
commit2e2a8e5491bc6259a9ebe8c703c1c501307953e2 (patch)
tree02ea9fdbe28ababc716eb9925a931f40905472df /lisp/ansi-color.el
parent117d58ace75fc210c15e6815d965b080466edc55 (diff)
downloademacs-2e2a8e5491bc6259a9ebe8c703c1c501307953e2.tar.gz
Man highlighting: Don't occasionally bold entire sections.
* lisp/ansi-color.el (ansi-color-apply-on-region): Always save a restart position in ansi-color-context-region if the region ends with highlighting active.
Diffstat (limited to 'lisp/ansi-color.el')
-rw-r--r--lisp/ansi-color.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el
index 141ad2353e8..c3b2d98c140 100644
--- a/lisp/ansi-color.el
+++ b/lisp/ansi-color.el
@@ -414,11 +414,17 @@ this."
;; if the rest of the region should have a face, put it there
(funcall ansi-color-apply-face-function
start-marker end-marker (ansi-color--find-face codes))
- (setq ansi-color-context-region (if codes (list codes)))))
+ ;; Save a restart position when there are codes active. It's
+ ;; convenient for man.el's process filter to pass `begin'
+ ;; positions that overlap regions previously colored; these
+ ;; `codes' should not be applied to that overlap, so we need
+ ;; to know where they should really start.
+ (setq ansi-color-context-region (if codes (list codes end-marker)))))
;; Clean up our temporary markers.
(unless (eq start-marker (cadr ansi-color-context-region))
(set-marker start-marker nil))
- (set-marker end-marker nil)))
+ (unless (eq end-marker (cadr ansi-color-context-region))
+ (set-marker end-marker nil))))
(defun ansi-color-apply-overlay-face (beg end face)
"Make an overlay from BEG to END, and apply face FACE.