Skip to content
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

A variation on the memory loop from Issue #4? #18

Closed
dafydd2277 opened this issue Aug 25, 2014 · 2 comments
Closed

A variation on the memory loop from Issue #4? #18

dafydd2277 opened this issue Aug 25, 2014 · 2 comments

Comments

@dafydd2277
Copy link

Vim 7.3 on OSX. I pulled the update from the resolution of Issue #4.

This time, I tried nesting a backtick'ed word inside a square bracket block for a link. I was flow typing at this time, which is to say I had not yet closed the square bracket block of text.

Which promptly hung Vim. I had to open another shell to kill it.

@dafydd2277
Copy link
Author

It wasn't the backtick. If I leave a left square bracket uncompleted by a right square bracket, VIM will eventually hang. It gets worse if I'm typing along. So far, the workaround is to get both brackets in ([]), then back up to fill in their contents.

gabrielelana added a commit that referenced this issue Sep 4, 2014
Apply the same optimizations done to resolve #18
@gabrielelana
Copy link
Owner

@dafydd2277 you are right, 9003a9b didn’t really fix #4 but only made things a little better. This fix was an hard one. The problem is that when you open a square bracket vim tries to match a really complex pattern to catch a markdownLinkContainer aka something like [text](url title)

If you wanna laugh this is how it looks right now /!\?\%(\\\)\@<!\[\%(\%([^\[\]]\|\\\[\|\\\]\)*\|\%([^\[\]]\|\\\[\|\\\]\)*\[\%([^\[\]]\|\\\[\|\\\]\)*\]\%([^\[\]]\|\\\[\|\\\]\)*\)\%(\n\%(\n\)\@!\%(\%([^\[\]]\|\\\[\|\\\]\)*\|\%([^\[\]]\|\\\[\|\\\]\)*\[\%([^\[\]]\|\\\[\|\\\]\)*\]\%([^\[\]]\|\\\[\|\\\]\)*\)\)*\]\%(\s*\|\n\%\(\n\)\@!\)\%(\%(\\\)\@<!(\%([^()]*\|[^()]*([^()]*)[^()]*\)\%(\n\%(\n\)\@!\%([^()]*\|[^()]*([^()]*)[^()]*\)\)*)\|\%(\\\)\@<!\[\%(\%([^\[\]]\|\\\[\|\\\]\)*\|\%([^\[\]]\|\\\[\|\\\]\)*\[\%([^\[\]]\|\\\[\|\\\]\)*\]\%([^\[\]]\|\\\[\|\\\]\)*\)\%(\n\%(\n\)\@!\%(\%([^\[\]]\|\\\[\|\\\]\)*\|\%([^\[\]]\|\\\[\|\\\]\)*\[\%([^\[\]]\|\\\[\|\\\]\)*\]\%([^\[\]]\|\\\[\|\\\]\)*\)\)*\]\)/

I did my best to avoid too much backtracking I think I did it, with things like this it doesn’t break a sweat but let me know you still have problems

Link with long long text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants