rainstormstudio / nerd-icons.el

GNU General Public License v3.0
206 stars 22 forks source link

font-lock breaks mdicons #34

Open titus-pinta opened 1 year ago

titus-pinta commented 1 year ago

I can use nerd-iicons-insert-mdicons in order to insert an icon, but when the font of the icon changes (say I add a comment) the icon breaks.

This only happens for Material design, all other icons work well. I have the fonts installed, because mdicons work in the preview and when I use the 'default face. If I remove the face, the error unicode character sometimes transforms back into the correct icon, but I can't reliably produce this.

Image: nf-bug-cropped

Here are the steps to reproduce it

init.el

;;;; Bug with nerd icons
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el"
             user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
    (url-retrieve-synchronously
     "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
     'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package '(nerd-icons :type git
                   :host github
                   :repo "rainstormstudio/nerd-icons.el"))

(require 'nerd-icons)

keyboard-macro

(fset 'nerd-icons-bug
      (kmacro-lambda-form [?\C-x ?\C-f ?t ?e ?s ?t return
                 ?\M-x ?e ?l ?i ?s ?p ?- ?m ?o ?d ?e return
                 ?\M-x ?n ?e ?r ?d ?- ?i ?c ?o ?n ?s ?- ?i ?n ?s ?e ?r ?t ?- ?m ?d ?i ?c ?o ?n return
                 tab ?- ?a ?t return return ?\;
                 ?\M-x ?n ?e ?r ?d ?- ?i ?c ?o ?n ?s ?- ?i ?n ?s ?e ?r ?t ?- ?m ?d ?i ?c ?o ?n return
                 tab ?- ?a ?t return return] 0 "%d"))

L.E. I have tried this on different computers, with different themes, and I get the same behavior.

rainstormstudio commented 1 year ago

I think this might be related to the code points of material icons in Nerd Font.

There are other bugs related to material icons so I'm afraid this issue might exist for some time