mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-13 10:25:46 +01:00
Sorry, stashed changes including:
Change util.range to accept an increment as the third argument.
Sanitize Makefile.doc
This commit is contained in:
@@ -1064,7 +1064,7 @@ function Buffer() //{{{
|
||||
let res = buffer.evaluateXPath(options["hinttags"], frame.document);
|
||||
for (let [,regex] in Iterator(regexps))
|
||||
{
|
||||
for (let i in util.range(res.snapshotLength, 0, true))
|
||||
for (let i in util.range(res.snapshotLength, 0, -1))
|
||||
{
|
||||
let elem = res.snapshotItem(i);
|
||||
if (regex.test(elem.textContent))
|
||||
|
||||
@@ -554,10 +554,10 @@ CompletionContext.prototype = {
|
||||
{
|
||||
let self = this;
|
||||
let items = this.items;
|
||||
let reverse = start > end;
|
||||
let step = start > end ? -1 : 1;
|
||||
start = Math.max(0, start || 0);
|
||||
end = Math.min(items.length, end ? end : items.length);
|
||||
return util.map(util.range(start, end, reverse), function (i) items[i]);
|
||||
return util.map(util.range(start, end, step), function (i) items[i]);
|
||||
},
|
||||
|
||||
getRows: function getRows(start, end, doc)
|
||||
@@ -565,10 +565,10 @@ CompletionContext.prototype = {
|
||||
let self = this;
|
||||
let items = this.items;
|
||||
let cache = this.cache.rows;
|
||||
let reverse = start > end;
|
||||
let step = start > end ? -1 : 1;
|
||||
start = Math.max(0, start || 0);
|
||||
end = Math.min(items.length, end != null ? end : items.length);
|
||||
for (let i in util.range(start, end, reverse))
|
||||
for (let i in util.range(start, end, step))
|
||||
yield [i, cache[i] = cache[i] || util.xmlToDom(self.createRow(items[i]), doc)];
|
||||
},
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ function Editor() //{{{
|
||||
function (args)
|
||||
{
|
||||
let matches = args.string.match(RegExp("^\\s*($|" + abbrevmatch + ")(?:\\s*$|\\s+(.*))"));
|
||||
if (! matches)
|
||||
if (!matches)
|
||||
{
|
||||
liberator.echoerr("E474: Invalid argument");
|
||||
return false;
|
||||
|
||||
@@ -519,25 +519,28 @@ const util = { //{{{
|
||||
},
|
||||
|
||||
/**
|
||||
* A generator that returns the values between <b>start</b> and <b>end</b>.
|
||||
* If <b>reverse</b> is true then the values are returned in reverse order.
|
||||
* A generator that returns the values between <b>start</b> and <b>end</b>,
|
||||
* in <b>step</b> increments.
|
||||
*
|
||||
* @param {number} start The interval's start value.
|
||||
* @param {number} end The interval's end value.
|
||||
* @param {boolean} reverse Reverse the order in which the values are produced.
|
||||
* @param {boolean} step The value to step the range by. May be
|
||||
* negative. @default 1
|
||||
* @returns {Iterator(Object)}
|
||||
*/
|
||||
range: function range(start, end, reverse)
|
||||
range: function range(start, end, step)
|
||||
{
|
||||
if (!reverse)
|
||||
if (!step)
|
||||
step = 1;
|
||||
if (step > 0)
|
||||
{
|
||||
while (start < end)
|
||||
yield start++;
|
||||
for (; start < end; start += step)
|
||||
yield start;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (start > end)
|
||||
yield --start;
|
||||
yield start += step;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user