branch: elpa/telephone-line
commit 8bc83573c36248923ecb5469404befffc3c2a799
Author: Daniel Bordak <[email protected]>
Commit: Daniel Bordak <[email protected]>
Fix unicode separators
Well, not entirely, but at least fix the issues introduced with the new
separators.
---
telephone-line-separators.el | 6 +++---
telephone-line-utils.el | 40 +++++++++++++++++++++-------------------
2 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/telephone-line-separators.el b/telephone-line-separators.el
index 18909e0296..fc4b3d3245 100644
--- a/telephone-line-separators.el
+++ b/telephone-line-separators.el
@@ -43,15 +43,15 @@
(defvar telephone-line-abs-left
(telephone-line-separator "abs-left"
:axis-func (telephone-line-complement abs)
- :alt-char #xe0b2))
+ :alt-char #xe0b0))
(defvar telephone-line-abs-hollow-right
(telephone-line-subseparator "abs-hollow-right"
:axis-func #'abs
- :alt-char #xe0b2))
+ :alt-char #xe0b3))
(defvar telephone-line-abs-hollow-left
(telephone-line-subseparator "abs-hollow-left"
:axis-func (telephone-line-complement abs)
- :alt-char #xe0b2))
+ :alt-char #xe0b1))
(defvar telephone-line-cubed-right
(telephone-line-separator "cubed-right"
diff --git a/telephone-line-utils.el b/telephone-line-utils.el
index 473f472f49..f975900f33 100644
--- a/telephone-line-utils.el
+++ b/telephone-line-utils.el
@@ -188,26 +188,28 @@ color1 and color2."
(face-attribute arg :background)
arg))
+(defmethod telephone-line-separator-render-image ((obj
telephone-line-separator) foreground background)
+ (let ((hash-key (concat background "_" foreground)))
+ ;; Return cached image if we have it.
+ (or (gethash hash-key (oref obj image-cache))
+ (puthash hash-key
+ (telephone-line-propertize-image
+ (telephone-line--create-pbm-image
(telephone-line-separator-create-body obj)
+ background foreground))
+ (oref obj image-cache)))))
+
+(defmethod telephone-line-separator-render-unicode ((obj
telephone-line-separator) foreground background)
+ (list :propertize (char-to-string (oref obj alt-char))
+ 'face (list :foreground foreground
+ :background background
+ :inverse-video t)))
+
(defmethod telephone-line-separator-render ((obj telephone-line-separator)
foreground background)
- (telephone-line-separator--render obj
- (telephone-line-separator--arg-handler foreground)
- (telephone-line-separator--arg-handler background)))
-
-(defmethod telephone-line-separator--render ((obj telephone-line-separator)
foreground background)
- (if window-system
- (let ((hash-key (concat background "_" foreground)))
- ;; Return cached image if we have it.
- (or (gethash hash-key (oref obj image-cache))
- (puthash hash-key
- (telephone-line-propertize-image
- (telephone-line--create-pbm-image
(telephone-line-separator-create-body obj)
- background foreground))
- (oref obj image-cache))))
-
- (list :propertize (char-to-string (oref obj alt-char))
- 'face (list :foreground foreground
- :background background
- :inverse-video t))))
+ (let ((fg-color (telephone-line-separator--arg-handler foreground))
+ (bg-color (telephone-line-separator--arg-handler background)))
+ (if window-system
+ (telephone-line-separator-render-image obj fg-color bg-color)
+ (telephone-line-separator-render-unicode obj fg-color bg-color))))
(defmethod telephone-line-separator-clear-cache ((obj
telephone-line-separator))
(clrhash (oref obj image-cache)))