-
Notifications
You must be signed in to change notification settings - Fork 78
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
Disable on long lines #46
Comments
Good idea. |
Well, it’s a while later, sorry, but I hope you’re still interested. The function is called call substitute( join( getline('w0','w$'), "\n" ), b:css_color_pat, '\=s:create_syn_match()', 'g' ) If you change that to the following, is that enough to make vim-css-color work on files where it choked before? call filter( range( line('w0'), line('w$') ), 'substitute( getline(v:val), b:css_color_pat, ''\=s:create_syn_match()'', ''g'' )' ) That doesn’t constrain the line length, but it processes a single line at a time instead of all the lines on screen at once, so it drastically cuts down on memory consumption. (It might make the function faster too, or it might make it slower, I can’t say. I’ll have to profile to find out.) I hope that this is enough to make it work without limiting line lengths, because then I would have to get into bytes vs characters issues, which would essentially force me to require a very recent Vim, something I am reluctant to do. (Even requiring Vim 7 bothers me. But it is what it is.) |
Profiling shows it to be something like 1–3%ish slower for common workloads and 5–7%ish faster for torturous workloads. That’s boils down to “no impact” as far I’m concerned, i.e. so far so good. |
There you go. This does not disable the plugin on long lines, instead it parses only what’s visible on screen (plus some amount of slop). Together with #43, css-color should now work fine for files of any size. Vim’s own syntax highlighting processing bogs down much worse than css-color in any case where css-color takes noticeable time. |
On extremely long lines, e.g. real world case
background-image: url('SUPER LONG DATA-URI');
, theparse_css_screen
function chokes because it runs out of memoryCan you turn off exclusively on or after parts of a line that is too long (e.g. exceeds the
synmaxcol
built-in to vim's syntax highlighting)?The text was updated successfully, but these errors were encountered: