-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
output of synID()
sometimes wrong when text is concealed
#5252
Comments
synID()
sometimes wrongsynID()
sometimes wrong when text is concealed
Does the output of at synID stabilize if you call it more than once in the same position? |
Yes, you're right. Invoking I wanted to report this, but I was trying to gather more information. Unfortunately, I haven't had enough time. For example, I think the matchit or matchparen plugin (not sure which one) influences the issue (maybe |
Yes, I definitely saw a similar issue when developing vim-matchup and I worked around it exactly as you say. However, I never correlated the issue to conceal in particular so I'm not sure if it is the same or two different issues. I'm both cases I think syntax must have some global state which is not cleared properly. |
The bug is still present. |
Describe the bug
I have a mapping in help files to jump to the next help tag; it sometimes unexpectedly skip a tag.
This is because my mapping searches for a pattern describing a tag (
'\\\@1<!|[#-)!+-~]\+|'
), then it checks the syntax under the cursor; if the latter is nothelpBar
norhelpHyperTextJump
, then the mapping searches again for the pattern, until it finds a match with the right syntax.The issue is due to
synID()
, whose output is sometimes the ID ofhelpExample
, while it should be the ID ofhelpBar
.To Reproduce
Write this code in
/tmp/vim.vim
:Now start Vim like this:
Press
cd
to invokeFunc()
which searches the next bar and echo the name of the syntax item under the cursor. The output ishelpBar
, which is correct.Finally, press
kk
to move 2 lines upward, and presscd
again; the cursor jumps to the same bar again, but this time, the output ishelpExample
, which is wrong.Expected behavior
The output of
synID()
is always the ID of the syntax grouphelpBar
; not sometimes the ID ofhelpBar
, and sometimes the ID ofhelpExample
.Screenshots
Environment
Additional Context
If the
'conceallevel'
option is set to 0, the issue disappears; so the issue is probably related to the conceal mechanism.If you press
C-o
to jump back to the original location, then presscd
again, the output ofsynID()
is correct (helpBar
). After that, if you presskk
to get back to the original location, then presscd
, the output is wrong again (helpExample
):In this last gif, I included the cursor positions before jumping to the bar, and after (via the output of
getcurpos()
):Notice how the cursor positions are always the same, including the curswant number, regardless of whether I press
kk
orC-o
to get back to the original position. IOW, before pressingcd
, I'm always in the exact same position, and afterward I always land in the exact same position; and yet, for some reason, the way I get back to the original position (kk
orC-o
) influences the output of the nextsynID()
, which is completely unexpected.The text was updated successfully, but these errors were encountered: