Syntax highlighting problem when foldmethod=syntax is set

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Syntax highlighting problem when foldmethod=syntax is set

Marcin Szewczyk-2
Hi,

I have noticed a problem with syntax highlighting when using the
following .vimrc (minimal to reproduce the thing):
#v+
syntax on
set nocompatible
set foldmethod=syntax
set nofoldenable
#v-

I am not sure if it is a bug or a feature because I rarely use folding
but I suspect the former.

With foldmethod=syntax making a comment (in C in this example) has the
following effect:
- /* makes many lines below to be colored as a comment,
- the comment body follows,
- after closing the comment with */ only the next line regains proper
  colors but other lines below remain being colored like a comment.

Without setting foldmethod=syntax highlighting works properly.

I have made some screenshots to visualize the problem:
http://wodny.org/download/vim-bug/

Should I fix something in my mindset or should I file a bug? Write on
vim_dev?



VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Feb 13 2017 01:36:41)
Included patches: 1-488, 576
Extra patches: 8.0.0322, 8.0.0056
Modified by [hidden email]
Compiled by [hidden email]
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
+balloon_eval    +float           +mouse_urxvt     -tag_any_white
+browse          +folding         +mouse_xterm     +tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
+clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      +toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  +lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      +X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
+emacs_tags      +mouseshape      -sniff           +xsmp_interact
+eval            +mouse_dec       +startuptime     +xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    +xpm


--
Marcin Szewczyk
http://wodny.org

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Syntax highlighting problem when foldmethod=syntax is set

Bram Moolenaar

Marcin Szewczyk wrote:

> I have noticed a problem with syntax highlighting when using the
> following .vimrc (minimal to reproduce the thing):
> #v+
> syntax on
> set nocompatible
> set foldmethod=syntax
> set nofoldenable
> #v-
>
> I am not sure if it is a bug or a feature because I rarely use folding
> but I suspect the former.
>
> With foldmethod=syntax making a comment (in C in this example) has the
> following effect:
> - /* makes many lines below to be colored as a comment,
> - the comment body follows,
> - after closing the comment with */ only the next line regains proper
>   colors but other lines below remain being colored like a comment.
>
> Without setting foldmethod=syntax highlighting works properly.
>
> I have made some screenshots to visualize the problem:
> http://wodny.org/download/vim-bug/
>
> Should I fix something in my mindset or should I file a bug? Write on
> vim_dev?

I can reproduce the problem.  With "set foldenable" and opening the
folds it doesn't happen.  Not sure if I have time to look into fixing
this.

--
Q: How do you tell the difference between a female cat and a male cat?
A: You ask it a question and if HE answers, it's a male but, if SHE
   answers, it's a female.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...