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
Syntax highlighting failure in GVim on Windows #1918
Comments
I can reproduce similar Vim script syntax fail on 8.0.1067 on Win 10 x64. In my case syntax breaks in gVim and CMD's Vim. Steps to reproduce:
reproduce.vim let a = foo()
let b = baz If I disable Breakage was introduced in patch 8.0.0647. Before that commit I cannot reproduce. |
Still exists in 8.0.1118 |
@xtal8 I also use Win 10 x64. But I don't reproduce it. |
@mattn Do you use x64 gVim also? I can't reproduce on x86. My version is downloaded from here https://github.com/vim/vim-win32-installer/releases |
Yes, I use x64. But I built vim with mingw compiler. |
Could you try to reproduce with gvim_8.0.1118_x64.zip from that link? |
I always download gvim from And both gvim_8.0.1118_x64.zip and gvim_8.0.1118_x86.zip downloaded from
:normal gg$
and than, You can encounter the issue in both gvim.exe and vim.exe. attachment: menu.vim |
I can reproduce issue with menu.vim only on gvim_8.0.1118_x64.zip. When I try to reproduce on x86. there's no syntax breakage. |
strange, on my laptop: gvim installed by gvim_8.0.1118_x86.exe has the problem. |
Just checked it, could not reproduce it with either one. |
This patch will fix the issue. diff --git a/src/syntax.c b/src/syntax.c
index 6361bd7aa..0d5af0cc3 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -6573,9 +6573,14 @@ syn_get_id(
else if (wp->w_buffer == syn_buf
&& lnum == current_lnum
&& col > current_col)
+ {
+ /* reset syn_tm here since this is not highlighting */
+ syn_tm = NULL;
+
/* next_match may not be correct when moving around, e.g. with the
* "skip" expression in searchpair() */
next_match_idx = -1;
+ }
(void)get_syntax_attr(col, spellp, keep_state);
syn_tm is set when start syntax to disable heavy syntax. matchparen call f_synstack(). And it call syn_get_id(), syn_get_attr(). This doesn't call syntax_call (this is correct pass). i.e. syn_tm is used unintentionally which is already timed-out. |
@brammool This should be temporary updating like below? diff --git a/src/syntax.c b/src/syntax.c
index 6361bd7aa..950ea7153 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -6564,6 +6564,8 @@ syn_get_id(
int *spellp, /* return: can do spell checking */
int keep_state) /* keep state of char at "col" */
{
+ proftime_T *save_tm = syn_tm;
+
/* When the position is not after the current position and in the same
* line of the same buffer, need to restart parsing. */
if (wp->w_buffer != syn_buf
@@ -6573,12 +6575,19 @@ syn_get_id(
else if (wp->w_buffer == syn_buf
&& lnum == current_lnum
&& col > current_col)
+ {
+ /* reset syn_tm here since this is not highlighting */
+ syn_tm = NULL;
+
/* next_match may not be correct when moving around, e.g. with the
* "skip" expression in searchpair() */
next_match_idx = -1;
+ }
(void)get_syntax_attr(col, spellp, keep_state);
+ syn_tm = save_tm;
+
return (trans ? current_trans_id : current_id);
}
|
Fixed by 8.0.1133 |
GVim version: 8.0.839 x86
Windows: Win 10 x64
GVim 8.0.636 works fine, but all the highlighting disappeared when I move around the cursor in GVim 8.0.839. Console mode is also fine, only the GVim:
command to reproduce:
gvim -N -u ..\initrc.vim d:/acm/github/vim/asc/menu.vim
content of initrc.vim:
If I enter these two line above in the vim, the bug will not be reproduced, they must be in initrc.vim and load before gvim startup.
The text was updated successfully, but these errors were encountered: