mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 12:47:59 +01:00
back/:forward has tab completion, slightly broken for wildmode=longest for now,
as we need to refactor g_substrings later
This commit is contained in:
1
NEWS
1
NEWS
@@ -3,6 +3,7 @@
|
||||
* version 0.5.2
|
||||
* added "s" and "a" mappings to extended hints mode for saving hint
|
||||
targets
|
||||
* :back/:forward can use tabcompletion
|
||||
* :undoall support, and tabcompletion for :undo <tab>
|
||||
* new :redraw and Ctrl-L commands for forced redrawing of the screen
|
||||
* added new 'laststatus' option and removed "s" value from 'guioptions'
|
||||
|
||||
1
TODO
1
TODO
@@ -22,7 +22,6 @@ FEATURES:
|
||||
9 Use our own find-as-you-type mechanism (like conkeror does)
|
||||
9 make hints smarter, not only with characters from from hintchars, but use "NE" or "NP" for 'new posts' e.g. (might be too slow)
|
||||
8 middleclick in content == p, and if command line is open, paste there the clipboard buffer
|
||||
8 it would be nice to have :(undo|back|forward) <url> w/ tab completion support
|
||||
7 [ctrl-o/i] to Go back to a Previous Position (done partly, however currenty does not use a per tab jumplist)
|
||||
7 whereever possible: get rid of dialogs and ask console-like dialog questions or write error prompts directly on the webpage or with :echo()
|
||||
7 3d should delete 3 tabs
|
||||
|
||||
@@ -240,13 +240,41 @@ function Commands() //{{{
|
||||
if (special)
|
||||
vimperator.history.goToStart();
|
||||
else
|
||||
{
|
||||
if (args)
|
||||
{
|
||||
var sh = getWebNavigation().sessionHistory;
|
||||
for (var i = sh.index - 1; i >= 0; i--)
|
||||
{
|
||||
if (sh.getEntryAtIndex(i, false).URI.spec == args)
|
||||
{
|
||||
getWebNavigation().gotoIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
vimperator.history.stepTo(count > 0 ? -1 * count : -1);
|
||||
}
|
||||
},
|
||||
{
|
||||
usage: ["[count]ba[ck][!]"],
|
||||
usage: ["[count]ba[ck][!] [url]"],
|
||||
short_help: "Go back in the browser history",
|
||||
help: "Count is supported, <code class=\"command\">:3back</code> goes back 3 pages in the browser history.<br/>" +
|
||||
"The special version <code class=\"command\">:back!</code> goes to the beginning of the browser history."
|
||||
"The special version <code class=\"command\">:back!</code> goes to the beginning of the browser history.",
|
||||
completer: function(filter)
|
||||
{
|
||||
var sh = getWebNavigation().sessionHistory;
|
||||
var completions = [];
|
||||
for (var i = sh.index - 1; i >= 0; i--)
|
||||
{
|
||||
var entry = sh.getEntryAtIndex(i, false);
|
||||
var url = entry.URI.spec;
|
||||
var title = entry.title;
|
||||
if (vimperator.completion.match(filter, [url, title], false))
|
||||
completions.push([url, title]);
|
||||
}
|
||||
return completions;
|
||||
}
|
||||
}
|
||||
));
|
||||
addDefaultCommand(new Command(["bd[elete]", "bw[ipeout]", "bun[load]", "tabc[lose]"],
|
||||
@@ -570,13 +598,41 @@ function Commands() //{{{
|
||||
if (special)
|
||||
vimperator.history.goToEnd();
|
||||
else
|
||||
{
|
||||
if (args)
|
||||
{
|
||||
var sh = getWebNavigation().sessionHistory;
|
||||
for (var i = sh.index + 1; i < sh.count; i++)
|
||||
{
|
||||
if (sh.getEntryAtIndex(i, false).URI.spec == args)
|
||||
{
|
||||
getWebNavigation().gotoIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
vimperator.history.stepTo(count > 0 ? count : 1);
|
||||
}
|
||||
},
|
||||
{
|
||||
usage: ["[count]fo[rward][!]"],
|
||||
usage: ["[count]fo[rward][!] [url]"],
|
||||
short_help: "Go forward in the browser history",
|
||||
help: "Count is supported, <code class=\"command\">:3forward</code> goes forward 3 pages in the browser history.<br/>" +
|
||||
"The special version <code class=\"command\">:forward!</code> goes to the end of the browser history."
|
||||
"The special version <code class=\"command\">:forward!</code> goes to the end of the browser history.",
|
||||
completer: function(filter)
|
||||
{
|
||||
var sh = getWebNavigation().sessionHistory;
|
||||
var completions = [];
|
||||
for (var i = sh.index + 1; i < sh.count; i++)
|
||||
{
|
||||
var entry = sh.getEntryAtIndex(i, false);
|
||||
var url = entry.URI.spec;
|
||||
var title = entry.title;
|
||||
if (vimperator.completion.match(filter, [url, title], false))
|
||||
completions.push([url, title]);
|
||||
}
|
||||
return completions;
|
||||
}
|
||||
}
|
||||
));
|
||||
addDefaultCommand(new Command(["ha[rdcopy]"],
|
||||
@@ -1538,7 +1594,10 @@ function Commands() //{{{
|
||||
for (var i = 0; i < undoItems.length; i++)
|
||||
{
|
||||
// undoItems[i].image is also available if need for favicons
|
||||
completions.push([undoItems[i].state.entries[0].url, undoItems[i].title]);
|
||||
var url = undoItems[i].state.entries[0].url;
|
||||
var title = undoItems[i].title;
|
||||
if (vimperator.completion.match(filter, [url, title], false))
|
||||
completions.push([url, title]);
|
||||
}
|
||||
return completions;
|
||||
}
|
||||
|
||||
@@ -540,6 +540,33 @@ vimperator.completion = (function() // {{{
|
||||
return build_longest_starting_substring(completions, filter);
|
||||
}, // }}}
|
||||
|
||||
// helper function which checks if the given arguments pass "filter"
|
||||
// items must be an array of strings
|
||||
// if case_sensitive == true, be sure to pass filter already in lowercased version
|
||||
match: function(filter, items, case_sensitive)
|
||||
{
|
||||
if (typeof(filter) != "string" || !items)
|
||||
return false;
|
||||
|
||||
if (case_sensitive)
|
||||
{
|
||||
for (var i = 0; i < items.length; i++)
|
||||
{
|
||||
if (items[i].toLowerCase().indexOf(filter) > -1)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var i = 0; i < items.length; i++)
|
||||
{
|
||||
if (items[i].indexOf(filter) > -1)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
exTabCompletion: function(str) //{{{
|
||||
{
|
||||
var [count, cmd, special, args] = vimperator.commands.parseCommand(str);
|
||||
|
||||
Reference in New Issue
Block a user