Don't reuse variable in s:clean_url (sticky type checking)

Versions of Vim prior to 7.4.1546 had sticky type checking which
prevented a variables type from changing. Fixes #715.
This commit is contained in:
Rane Brown 2019-07-12 13:52:23 -06:00
parent af12065e92
commit 466bdcd4e8
2 changed files with 11 additions and 9 deletions

View File

@ -2065,18 +2065,18 @@ function! s:clean_url(url)
let url = substitute(a:url, '^\a\+\d*:', '', '') let url = substitute(a:url, '^\a\+\d*:', '', '')
let url = substitute(url, '^//', '', '') let url = substitute(url, '^//', '', '')
let url = substitute(url, '^\([^/]\+\)\.\a\{2,4}/', '\1/', '') let url = substitute(url, '^\([^/]\+\)\.\a\{2,4}/', '\1/', '')
let url = split(url, '/\|=\|-\|&\|?\|\.') let url_l = split(url, '/\|=\|-\|&\|?\|\.')
let url = filter(url, 'v:val !=# ""') let url_l = filter(url_l, 'v:val !=# ""')
if url[0] == "www" if url_l[0] == "www"
let url = url[1:] let url_l = url_l[1:]
endif endif
if url[-1] =~ '^\(htm\|html\|php\)$' if url_l[-1] =~ '^\(htm\|html\|php\)$'
let url = url[0:-2] let url_l = url_l[0:-2]
endif endif
" remove words consisting of only hexadecimal digits or non-word characters " remove words consisting of only hexadecimal digits or non-word characters
let url = filter(url, 'v:val !~ "^\\A\\{4,}$"') let url_l = filter(url_l, 'v:val !~ "^\\A\\{4,}$"')
let url = filter(url, 'v:val !~ "^\\x\\{4,}$" || v:val !~ "\\d"') let url_l = filter(url_l, 'v:val !~ "^\\x\\{4,}$" || v:val !~ "\\d"')
return join(url, " ") return join(url_l, " ")
endfunction endfunction

View File

@ -3518,6 +3518,8 @@ Removed:~
point. point.
Fixed:~ Fixed:~
* Issue #715: s:clean_url is compatible with vim pre 7.4.1546 (sticky type
checking)
* Issue #729: Normalize links uses relative paths in diary pages for * Issue #729: Normalize links uses relative paths in diary pages for
Markdown syntax. This previously only worked for the default syntax. Markdown syntax. This previously only worked for the default syntax.
* Modify horizontal rule (thematic-breaks) syntax for markdown. * Modify horizontal rule (thematic-breaks) syntax for markdown.