aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2018-07-19 20:44:32 +0300
committerEli Zaretskii2018-07-19 20:44:32 +0300
commitba9b9bb4accda749be5a3803569ef1dc2de6919a (patch)
treec33a9aafdfb8938658cbe990a36383a8f7d14930
parentf56ad422c42aabc24e92ea13012692d581b7efbe (diff)
downloademacs-ba9b9bb4accda749be5a3803569ef1dc2de6919a.tar.gz
emacs-ba9b9bb4accda749be5a3803569ef1dc2de6919a.zip
Fix TTY colors breakage by 'clear-face-cache'
Without examining the right frame, 'tty-color-24bit' was erroneously treating a GUI frame as a 24-bit TTY frame. * lisp/term/tty-colors.el (tty-color-24bit): Accept optional argument DISPLAY and pass it to display-color-cells. Doc fix. (tty-color-define, tty-color-desc): Pass the FRAME argument to tty-color-24bit. (Bug#32072)
-rw-r--r--lisp/term/tty-colors.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el
index ab9149e6b42..a776c830a25 100644
--- a/lisp/term/tty-colors.el
+++ b/lisp/term/tty-colors.el
@@ -824,10 +824,12 @@ A canonicalized color name is all-lower case, with any blanks removed."
824 (replace-regexp-in-string " +" "" (downcase color)) 824 (replace-regexp-in-string " +" "" (downcase color))
825 color))) 825 color)))
826 826
827(defun tty-color-24bit (rgb) 827(defun tty-color-24bit (rgb &optional display)
828 "Return pixel value on 24-bit terminals. Return nil if RGB is 828 "Return 24-bit color pixel value for RGB value on DISPLAY.
829nil or not on 24-bit terminal." 829DISPLAY can be a display name or a frame, and defaults to the
830 (when (and rgb (= (display-color-cells) 16777216)) 830selected frame's display.
831If DISPLAY is not on a 24-but TTY terminal, return nil."
832 (when (and rgb (= (display-color-cells display) 16777216))
831 (let ((r (lsh (car rgb) -8)) 833 (let ((r (lsh (car rgb) -8))
832 (g (lsh (cadr rgb) -8)) 834 (g (lsh (cadr rgb) -8))
833 (b (lsh (nth 2 rgb) -8))) 835 (b (lsh (nth 2 rgb) -8)))
@@ -850,7 +852,7 @@ If FRAME is not specified or is nil, it defaults to the selected frame."
850 (error "Invalid specification for tty color \"%s\"" name)) 852 (error "Invalid specification for tty color \"%s\"" name))
851 (tty-modify-color-alist 853 (tty-modify-color-alist
852 (append (list (tty-color-canonicalize name) 854 (append (list (tty-color-canonicalize name)
853 (or (tty-color-24bit rgb) index)) 855 (or (tty-color-24bit rgb frame) index))
854 rgb) 856 rgb)
855 frame)) 857 frame))
856 858
@@ -1026,7 +1028,7 @@ might need to be approximated if it is not supported directly."
1026 (or (assoc color (tty-color-alist frame)) 1028 (or (assoc color (tty-color-alist frame))
1027 (let ((rgb (tty-color-standard-values color))) 1029 (let ((rgb (tty-color-standard-values color)))
1028 (and rgb 1030 (and rgb
1029 (let ((pixel (tty-color-24bit rgb))) 1031 (let ((pixel (tty-color-24bit rgb frame)))
1030 (or (and pixel (cons color (cons pixel rgb))) 1032 (or (and pixel (cons color (cons pixel rgb)))
1031 (tty-color-approximate rgb frame))))))))) 1033 (tty-color-approximate rgb frame)))))))))
1032 1034