On 15/01/14 11:10, Aidan Marlin wrote:
Vim devs,

I have discovered a bug which affects at least 7.4.135 and (likely) 7.3.547. 
Example file is available at 
https://mega.co.nz/#!ndVjXZTY!aMX_9ll-0ce861tQwNZBaFveb_kONCJxvAT2GZOvzlc 
(1.2MB in size) which will crash vim when attempting the following regex:

:%s/\n//g

The file contains 20 000 lines, each line containing 60 characters.

Join (:%j) works fine and fast in these versions of vim, while the above regex 
seems to consume excessive amounts of memory, and results in vim crash.

Regards,

Aidan M.


The equivalent of :%s/\n//g (with no space between the last two slashes) is not :%j but :%j! (join without adding or removing any spaces). Even so, it is to be expected that the join goes faster and with less bugs than the substitute, since it is known in advance that a join will always result in a single pass through the text, with no lookahead, no look-behind, no pattern parsing, etc.

Thanks for reporting the bug: "Error: not enough memory" may be acceptable in some circumstances, but a crash is never acceptable.


Best regards,
Tony.
--
I don't deserve this award, but I have arthritis and I don't deserve that
either.
                -- Jack Benny

--
--
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

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui