1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 01:14:10 +01:00

Allow C-c to interrupt search highlighting

This commit is contained in:
Kris Maglione
2008-10-07 14:25:18 +00:00
parent 73a2d510a7
commit 45ad9f0c8b
4 changed files with 20 additions and 10 deletions

View File

@@ -195,6 +195,8 @@ liberator.Search = function () //{{{
this.endPt.setStart(body, count);
this.endPt.setEnd(body, count);
liberator.interrupted = false;
let n = 0;
for (let retRange in this.search(aWord, caseSensitive))
{
// Highlight
@@ -203,6 +205,10 @@ liberator.Search = function () //{{{
this.startPt = node.ownerDocument.createRange();
this.startPt.setStart(node, node.childNodes.length);
this.startPt.setEnd(node, node.childNodes.length);
if (n++ % 20 == 0)
liberator.threadyield();
if (liberator.interrupted)
break;
}
},