diff --git a/eat.el b/eat.el index 476a33a..e07081b 100644 --- a/eat.el +++ b/eat.el @@ -2362,6 +2362,53 @@ character or its the internal invisible spaces." (insert (propertize " " 'face face)) (backward-char))))) +(defconst eat--t-dec-line-drawing-chars + (eval-and-compile + (let ((alist '((?+ . ?→) + (?, . ?←) + (?- . ?↑) + (?. . ?↓) + (?0 . ?█) + (?\` . ?�) + (?a . ?▒) + (?b . ?␉) + (?c . ?␌) + (?d . ?␍) + (?e . ?␊) + (?f . ?°) + (?g . ?±) + (?h . ?░) + (?i . ?#) + (?j . ?┘) + (?k . ?┐) + (?l . ?┌) + (?m . ?└) + (?n . ?┼) + (?o . ?⎺) + (?p . ?⎻) + (?q . ?─) + (?r . ?⎼) + (?s . ?⎽) + (?t . ?├) + (?u . ?┤) + (?v . ?┴) + (?w . ?┬) + (?x . ?│) + (?y . ?≤) + (?z . ?≥) + (?{ . ?π) + (?| . ?≠) + (?} . ?£) + (?~ . ?•))) + (table (make-hash-table :purecopy t))) + (dolist (pair alist) + (puthash (car pair) (cdr pair) table)) + table)) + "Hash table for DEC Line Drawing charset. + +The key is the output character from client, and value of the +character to actually show.") + (defun eat--t-write (str) "Write STR on display." (let ((face (eat--t-face-face (eat--t-term-face eat--t-term))) @@ -2387,43 +2434,8 @@ character or its the internal invisible spaces." ;; `us-ascii'. ('dec-line-drawing (dotimes (i (length str)) - (let ((replacement (alist-get (aref str i) - '((?+ . ?→) - (?, . ?←) - (?- . ?↑) - (?. . ?↓) - (?0 . ?█) - (?\` . ?�) - (?a . ?▒) - (?b . ?␉) - (?c . ?␌) - (?d . ?␍) - (?e . ?␊) - (?f . ?°) - (?g . ?±) - (?h . ?░) - (?i . ?#) - (?j . ?┘) - (?k . ?┐) - (?l . ?┌) - (?m . ?└) - (?n . ?┼) - (?o . ?⎺) - (?p . ?⎻) - (?q . ?─) - (?r . ?⎼) - (?s . ?⎽) - (?t . ?├) - (?u . ?┤) - (?v . ?┴) - (?w . ?┬) - (?x . ?│) - (?y . ?≤) - (?z . ?≥) - (?{ . ?π) - (?| . ?≠) - (?} . ?£) - (?~ . ?•))))) + (let ((replacement + (gethash (aref str i) eat--t-dec-line-drawing-chars))) (when replacement (aset str i replacement)))))) ;; Find all the multi-column wide characters in STR, using a