mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 02:07:58 +01:00
wildmode and wildsort support
:open . and .. and .../ supported
This commit is contained in:
@@ -107,7 +107,7 @@ var g_commands = [/*{{{*/
|
||||
["buffer", "b"],
|
||||
["b[uffer]"],
|
||||
"Go to buffer number n. Full completion works.",
|
||||
function (args) { tab_go(args.split(":")[0]); },
|
||||
buffer_switch,
|
||||
function (filter) {return get_buffer_completions(filter);}
|
||||
],
|
||||
[
|
||||
@@ -1250,6 +1250,35 @@ function stringToURLs(str)
|
||||
}
|
||||
}
|
||||
|
||||
// check for ./ and ../ (or even .../) to go to a file in the upper directory
|
||||
if (urls[url].match(/^(\.$|\.\/\S*)/))
|
||||
{
|
||||
var newLocation = getCurrentLocation();
|
||||
newLocation = newLocation.replace(/([\s\S]+)\/[^\/]*/, "$1");
|
||||
if(urls[url].match(/^\.(\/\S+)/))
|
||||
newLocation += urls[url].replace(/^\.(\/\S+)/, "$1");
|
||||
|
||||
urls[url] = newLocation;
|
||||
}
|
||||
else if (urls[url].match(/^(\.\.$|\.\.\/[\S]*)/))
|
||||
{
|
||||
var newLocation = getCurrentLocation();
|
||||
newLocation = newLocation.replace(/([\s\S]+)\/[^\/]*/, "$1/../");
|
||||
if(urls[url].match(/^\.\.(\/\S+)/))
|
||||
newLocation += urls[url].replace(/^\.\.\/(\S+)/, "$1");
|
||||
|
||||
urls[url] = newLocation;
|
||||
}
|
||||
else if (urls[url].match(/^(\.\.\.$|\.\.\.\/[\S]*)/))
|
||||
{
|
||||
var newLocation = getCurrentLocation();
|
||||
newLocation = newLocation.replace(/([\s\S]+):\/\/\/?(\S+?)\/\S*/, "$1://$2/");
|
||||
if(urls[url].match(/^\.\.\.(\/\S+)/))
|
||||
newLocation += urls[url].replace(/^\.\.\.\/(\S+)/, "$1");
|
||||
|
||||
urls[url] = newLocation;
|
||||
}
|
||||
|
||||
/* if the string contains a space or does not contain any of: .:/
|
||||
* open it with default searchengine */
|
||||
if (urls[url].match(/\s+/) || urls[url].match(/\.|:|\//) == null)
|
||||
@@ -1519,6 +1548,19 @@ function bufshow(filter, in_comp_window)
|
||||
}
|
||||
}
|
||||
|
||||
function buffer_switch(string)
|
||||
{
|
||||
var match;
|
||||
if (match = string.match(/^(\d+):?/))
|
||||
return tab_go(match[1]);
|
||||
for (var i = 0; i < getBrowser().browsers.length; i++)
|
||||
{
|
||||
var url = getBrowser().getBrowserAtIndex(i).contentDocument.location.href;
|
||||
if (url == string)
|
||||
return tab_go(i);
|
||||
}
|
||||
}
|
||||
|
||||
//toggles the buffer preview window
|
||||
function buffer_preview_toggle()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user