I expected %% (pressing '%' twice) to be a nop. But, while editing
some antlr file I bumped into this example:
('12'3'('45')')
If you go to the last position and type % you teleport to the first
position, but if you type % again nothing happens (you remain on the
first position). Perhaps a simpler example is
('('12')')
If you go on the *second* ( and type % you end up on the last ). If
you type % again you are taken to the *first* (.
The code is in search.c around line 2280. While scanning, vim skips
over 'x' and '\x' (x stands for anything), but it doesn't take into
account if you *started* the search inside such a group. I think that
starting the search inside such a group should deactivate the
skipping. If you agree, then I can try to send a patch.
However, this only fixes the second ("simpler") example. The first one
will still behave unexpectedly. I don't know what would be a good
solution to this one. One option is to have an option to disable
skipping. AFAICT the only way to do it now is to set 'compatible',
which is too heavyweight. (Please let me know if there are other
solutions.) Another option would be to disable skipping if it's not
clear which are the groups 'x'. This would be analogous to how " are
treated now: if there's an odd (uneven) number of them per line then
skipping string literals is deactivated. Similarly, if you see 'x'x'
then you don't really know which one you are supposed to skip, so
perhaps character literals skipping should be deactivated.
In antlr you frequently write grammar rules like
signature: ID '(' lst ')' ('returns' '(' lst ')')?
Note the text
'returns' '('
So it is not that infrequent for vim to mess up on %.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---