On 3/03/11 7:37 AM, Bram Moolenaar wrote:
Ben Schmidt wrote:
The attached preliminary patch puts in a check for this and a couple of
other possible syntax overflow conditions, so we should get errors, not
crashes.

It fixes this particular problem for me. An error occurs when the file
is loaded, and scrolling is slow, but doesn't crash, and can be
interrupted with control-C.

Can others test this and confirm?

Bram, if you're happy with this approach, I can tidy up the patch a bit,
i.e. put in error message numbers, including in the documentation, if
that's helpful.

The checks for things going wrong are obviously good.  I wonder if we
can change the numbers without causing trouble.  I don't think we ever
thought of hitting these limits.

I think changing the numbers would just be a bigger job, but wouldn't
really cause problems. At the moment the type for syntax ids is a short,
so that would have to be changed throughout in order to increase the
numbers.

On the other hand, allowing ridiculous numbers probably makes Vim run
really slow, thus disallowing this might be better.  Or we need to fix
the slowness.

Probably by turning the grow arrays for syntax id lists into hash tables
(probably pretty space inefficient?) or at least keeping them ordered
and doing binary search (slow when manipulating syntax group lists, but
quick otherwise--but would need special casing to keep ALLBUT, etc. at
the front and deal with them appropriately, even though they have larger
ids than normal syntax groups).

One thing that probably should be changed somehow is having some way to
reset running_syn_inc_id, which increases but has no way to be reset. A
:syn clear or something should probably pull it back to zero.

Ben.



--
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui