Friday, December 27, 2019

automatic redraw for multi-line syntax highlighting patterns

Hi,

the docs state (:help syn-multi-line) that syntax highlighting with multi-line patterns "mostly works as expected".  I am not sure if this "mostly" includes automatic highlighting change of a multi-line syntax group when it's modified. Especially as soon as the pattern's end is destroyed. For example, take the commands of a session file ~/tmp/s.vim:
call append(0, ['( comment?', ')'])  syntax sync fromstart  hi link m Comment  syntax match m /(.*\n)/  
They give us two lines highlighted as a comment (:hi Comment):
( comment?  )
Now, let's change the ')' into an 'x' via "2gg0rx". The test in the two lines does not match the defined syntax group anymore. But the display does not reflect this change right away. Instead I get something that's displayed partly as a comment (line 1) and partly as normal text (line 2):
( comment?  )
Note the different color of the two parentheses. I have to press CTRL-L to see the comment highlighting disappear completely.  Having set syntax syncing to start from the very start of the file I would expect this to happen automatically. Is this imperfection the reason why the help says "mostly works" instead of "always works"? Or am I missing something?

This is Vim 8.1.2337 (Huge version with GTK2 GUI) on Debian GNU/Linux, started with:
vim --clean -S ~/tmp/s.vim

Thanks in advance for all your insights,

Tom

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAD_dSXiPJzHXRqpWgtKQPS0Y8UhBkk3Ns6iCtJW566jKgcJysw%40mail.gmail.com.

No comments:

Post a Comment