1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 18:37:58 +01:00

Fixed ctrl-a/x with 0003-style urls, thanks hogelog

This commit is contained in:
Martin Stubenschrott
2008-12-22 13:15:05 +01:00
parent 3482269980
commit db0fa4bc5b

View File

@@ -127,26 +127,28 @@ const config = { //{{{
init: function () init: function ()
{ {
// TODO: support 'nrformats'? // TODO: support 'nrformats'? -> probably not worth it --mst
function incrementURL(count) function incrementURL(count)
{ {
let matches = buffer.URL.match(/(.*?)(\d+)(\D*)$/); let matches = buffer.URL.match(/(.*?)(\d+)(\D*)$/);
if (!matches) if (!matches)
return liberator.beep();
let [, pre, number, post] = matches;
let newNumber = parseInt(number, 10) + count;
let newNumberStr = String(newNumber > 0 ? newNumber : 0);
if (number.match(/^0/)) // add 0009<C-a> should become 0010
{ {
liberator.beep(); while(newNumberStr.length < number.length)
return; newNumberStr = "0" + newNumberStr;
} }
[, pre, number, post] = matches; liberator.open(pre + newNumberStr + post);
let newNumber = parseInt(number, 10) + count;
liberator.open(pre + (newNumber > 0 ? newNumber : 0) + post);
} }
// load Vimperator specific modules // load Vimperator specific modules
// FIXME: Why aren't these listed in config.scripts? // FIXME: Why aren't these listed in config.scripts?
// FIXME: Why isn't this automatic? // FIXME: Why isn't this automatic? -> how would one know which classes to load where? --mst
liberator.loadModule("search", Search); liberator.loadModule("search", Search);
liberator.loadModule("bookmarks", Bookmarks); liberator.loadModule("bookmarks", Bookmarks);
liberator.loadModule("history", History); liberator.loadModule("history", History);