1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 15:22:26 +01:00

remove spaces from strings which look like urls

This commit is contained in:
Martin Stubenschrott
2008-11-29 15:29:32 +00:00
parent 36b676d508
commit 3f6f53580f
2 changed files with 7 additions and 0 deletions

3
NEWS
View File

@@ -16,6 +16,9 @@
* IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and * IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and
VimperatorLeave respectively VimperatorLeave respectively
* remove spaces and newlines when open urls starting with http:// or similar
before :o http://linux .com would search for http://linux and for .com, now
it just opens linux.com. Also handy when pasting broken urls with p or P.
* add 'wildcase' option * add 'wildcase' option
* 'linkbgcolor', 'linkfgcolor', ... have been replaced with highlight * 'linkbgcolor', 'linkfgcolor', ... have been replaced with highlight
groups, HintElem and HintActive groups, HintElem and HintActive

View File

@@ -470,6 +470,10 @@ const util = { //{{{
} }
catch (e) {} catch (e) {}
// removes spaces from the string if it starts with http:// or something like that
if (/^\w+:\/\//.test(urls[url]))
urls[url] = urls[url].replace(/\s+/g, "");
// strip each 'URL' - makes things simpler later on // strip each 'URL' - makes things simpler later on
urls[url] = urls[url].replace(/^\s+/, "").replace(/\s+$/, ""); urls[url] = urls[url].replace(/^\s+/, "").replace(/\s+$/, "");