emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/popup e742014 180/184: Merge pull request #124 from auto-c


From: ELPA Syncer
Subject: [nongnu] elpa/popup e742014 180/184: Merge pull request #124 from auto-complete/dis
Date: Wed, 6 Oct 2021 00:01:38 -0400 (EDT)

branch: elpa/popup
commit e7420146a7bc6365e4a56af28508aa9687a9906e
Merge: 866a091 416049d
Author: Jen-Chieh Shen <jcs090218@gmail.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #124 from auto-complete/dis
    
    Fix non displayable character
---
 popup.el | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/popup.el b/popup.el
index ed7efac..4fee3ac 100644
--- a/popup.el
+++ b/popup.el
@@ -33,6 +33,7 @@
 ;;; Code:
 
 (require 'cl-lib)
+(require 'mule)
 
 (defconst popup-version "0.5.8")
 
@@ -238,6 +239,19 @@ ITEM is not string."
   (if (stringp item)
       (get-text-property 0 property item)))
 
+(defun popup-replace-displayable (str &optional rep)
+  "Replace non-displayable character from STR.
+
+Optional argument REP is the replacement string of non-displayable character."
+  (unless rep (setq rep ""))
+  (let ((result ""))
+    (mapcar (lambda (ch)
+              (setq result (concat result
+                                   (if (char-displayable-p ch) (string ch)
+                                     rep))))
+            str)
+    result))
+
 (cl-defun popup-make-item (name
                            &key
                            value
@@ -1057,6 +1071,8 @@ PROMPT is a prompt string when reading events during 
event loop."
     ;; TODO strip text (mainly face) properties
     (setq string (substring-no-properties string)))
 
+  (setq string (popup-replace-displayable string))
+
   (and (eq margin t) (setq margin 1))
   (or margin-left (setq margin-left margin))
   (or margin-right (setq margin-right margin))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]