jming422/fira-code-mode

Ligature malformation when cursor on line

Closed this issue · 11 comments

I have been using your plugin for the last couple of days.
I have a problem which I cannot find the side effect that creates it.

When my cursor is on a line that contains a ligature, the ligature becomes malformed and when the cursor leaves that line the ligature appears as it should.
The images below show the problem I have encountered.
notonline
online

Hi @innerout - thanks for using my package! I'm not able to reproduce this bug on my end - in a buffer that's having this bug (while the ligature is malformed), can you run C-h v prettify-symbols-alist and look at its value? It seems to me like there's some other package or mode that's conflicting with fira-code-mode, which could happen if another package is using prettify-symbols-mode under the hood.

I cannot figure out what's happening so I am attaching the buffer that is shown when I run
C-h v prettify-symbols-alist .
prettify-symbols.txt

Thanks for attaching it - I compared your output to my working version and it's basically the same, so that means that whatever's going on probably doesn't have to do with prettify-symbols-mode.

I don't have any other guesses at the moment as to the underlying issue, but I still think it's probably a conflict with another package. Some things you could try and investigate:

  • Try starting emacs without config as emacs -q, then only loading fira-code-mode to see if it works on its own.
  • If it works from emacs -q, you could try to figure out which package is conflicting by enabling them one at a time and checking to see when it breaks.

OK thanks for the feedback I will try disabling packages that could result to this behavior and report back when I find it in order for others to avoid it.

@innerout Any chance you've got an update on this? If not, I'd like to close this issue for now, and just open another issue when we figure out where the conflict is coming from.

Can you give me a couple of days more? I have been trying to solve the issue and I believe I am close to narrowing down which mode is the culprit.

After testing every possible mode that could cause this problem I have found that
(global-hl-line-mode) makes ligatures malformed.
When it is disabled the ligatures appear as they should.

Great, thanks for finding that out! I'll look into this as soon as I get the time.

Also something odd that I observed is, when I disable global-hl-line-mode in a buffer with your plugin activated every ligature in the buffer becomes malformed and does not revert back to its normal state.

I still can't reproduce this in my environment or with emacs -q, unfortunately; for me global-hl-line-mode doesn't interfere with the ligatures.

...when I disable global-hl-line-mode in a buffer with your plugin activated every ligature in the buffer becomes malformed and does not revert back to its normal state.

This is very strange, and isn't anything my package could be affecting - it sounds like somehow prettify-symbols-mode isn't behaving in its usual way. Perhaps your theme or major mode is modifying the behavior of prettify-symbols-mode or global-hl-line-mode?

All fira-code-mode really does is add a bunch of things to prettify-symbols-alist and let prettify-symbols-mode (defined in prog-mode) do the rest. I don't think I can fix the issue you're having with this package if the issue has to do with prettify-symbols-mode not working in your configuration - my Emacs Lisp-fu isn't nearly good enough to debug such specific bugs with something from prog-mode.

I'm closing this issue since it's out of scope for fira-code-mode itself. Some next steps you could try are searching to see if other users of your theme have had issues with prettify-symbols-mode, or trying one of the other methods for enabling Fira Code ligatures in Emacs. I hope that you can get this figured out and have beautiful ligatures!

I will try uploading a minimal config that triggers this in my setup if that helps you.