odeke-em / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

vimNumber pattern in vim syntax too aggressive #284

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a vimscript buffer with syntax highlighting enabled.
2. Type "call foolib#AddDefaultThingy".

What is the expected output? What do you see instead?
I would expect the text "AddDefaultThingy" to be all the same color / syntax 
group, but instead "#AddDef" is matched as a vimNumber and highlighted yellow, 
while the preceding "foolib" and the remaining "aultThingy" are white.

What version of the product are you using? On what operating system?
vim 7.4.473 on Ubuntu 14.04

Original issue reported on code.google.com by dbarn...@google.com on 15 Nov 2014 at 2:02

GoogleCodeExporter commented 9 years ago
The problem is this line in $VIMRUNTIME/syntax/vim.vim:
  syn match vimNumber   "#\x\{6}"

Seems like it's intended to match hex color codes for HTML/CSS. Adding \b after 
it would help it to not match so broadly. Also, "#\x\{3}" would be just as 
valid, unless that was intentionally omitted because short matches have a 
higher chance of false positives.

Original comment by dbarn...@google.com on 15 Nov 2014 at 2:08

GoogleCodeExporter commented 9 years ago
Meant to say "too aggressive". I don't think I have permission to edit the 
subject, though. =(

Original comment by dbarn...@google.com on 15 Nov 2014 at 2:09

GoogleCodeExporter commented 9 years ago
Changed the Title. I am sure, Charles will fix this soon.

Original comment by chrisbr...@googlemail.com on 15 Nov 2014 at 12:11

GoogleCodeExporter commented 9 years ago
Please try http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM .  I 
didn't use the suggestion of trying to require a match to a backspace character 
(\b), btw :) .
  Its better to simply email messages to syntax file maintainers than to use the vim bugzilla for that purpose -- its for vim bugs, not syntax, ftplugins, etc.  I (Chip) happen to be able to respond via the bugzilla, but I rather suspect that most syntax file maintainers cannot do so.
  I'm marking this report as fixed; if there's still a problem, please use my email (see the syntax/vim.vim file).

Original comment by drc...@campbellfamily.biz on 17 Nov 2014 at 9:28