Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange interaction with whitespace-mode’s highlighting of long lines #569

Open
guillaumebrunerie opened this issue Mar 30, 2021 · 1 comment

Comments

@guillaumebrunerie
Copy link

I’m using js2-mode together with whitespace-mode to highlight the part of the line that is over 80 characters, and it seems like the syntax highlighting gets messed up somehow. This doesn’t happen with js-mode or other major modes.

Steps to reproduce:
Start emacs with -Q and evaluate the following lines (assuming js2-mode is installed)

(require 'package)
(package-initialize)
(global-whitespace-mode)
(setq whitespace-style '(face lines-tail))
(set-face-attribute 'whitespace-line nil :background "Blue" :foreground nil)

Now open a new .js file, activate js2-mode, and write a long syntactically correct line (long enough that the end becomes blue)

var xxxxxxxxxxxxxxx = 3;

Now add // at the beginning of the line, and note that only the beginning of the line got updated to a red foreground color, the end of the line still uses the old foreground color.
Add a space at the end of the line and remove it: it now updates the foreground color of the end of the line to be red too.
Remove //, it only updates the foreground color of the beginning of the line, the end of the line stays red.

In js-mode or for instance emacs-lisp-mode it works fine, the foreground color gets updated immediately on the whole line.

@dgutov
Copy link
Collaborator

dgutov commented Apr 3, 2021

Hi!

Thanks for the report.

By "red foreground", you mean the foreground of the comment face? If so, I see it.

This might be a fundamental limitation in how font-lock's font-lock-face mapping works. Or it might just require the js2-mode parser to be triggered from syntax-propertize-function. IOW, I see no quick fixes for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants