aboutsummaryrefslogtreecommitdiffstats
path: root/vimiumFrontend.js
diff options
context:
space:
mode:
Diffstat (limited to 'vimiumFrontend.js')
-rw-r--r--vimiumFrontend.js21
1 files changed, 18 insertions, 3 deletions
diff --git a/vimiumFrontend.js b/vimiumFrontend.js
index e217e955..a22cbd8f 100644
--- a/vimiumFrontend.js
+++ b/vimiumFrontend.js
@@ -8,6 +8,7 @@ var getCurrentUrlHandlers = []; // function(url)
var insertModeLock = null;
var findMode = false;
+var findModeMatchIndex = 0;
var findModeQuery = "";
var findModeQueryHasResults = false;
var isShowingHelpDialog = false;
@@ -339,7 +340,7 @@ function copyCurrentUrl() {
var getCurrentUrlPort = chrome.extension.connect({ name: "getCurrentTabUrl" });
getCurrentUrlPort.postMessage({});
- HUD.showForDuration("Yanked URL", 1000);
+ HUD.showForDuration("Yanked URL", 1000);
}
function toggleViewSourceCallback(url) {
@@ -619,8 +620,8 @@ function handleDeleteForFindMode() {
}
function handleEnterForFindMode() {
- exitFindMode();
performFindInPlace();
+ exitFindMode();
}
function performFindInPlace() {
@@ -639,7 +640,21 @@ function performFindInPlace() {
}
function executeFind(backwards) {
- findModeQueryHasResults = window.find(findModeQuery, false, backwards, true, false, true, false);
+ var pattern = new RegExp(findModeQuery, "g");
+ var text = document.body.textContent;
+ var result = text.match(pattern);
+ if ( ! findMode )
+ if (backwards)
+ if (findModeMatchIndex > 0)
+ findModeMatchIndex -= 1;
+ else
+ findModeMatchIndex = result.length - 1;
+ else
+ if (findModeMatchIndex < result.length - 1)
+ findModeMatchIndex += 1;
+ else
+ findModeMatchIndex = 0;
+ findModeQueryHasResults = window.find(result[findModeMatchIndex], false, backwards, true, false, true, false);
}
function focusFoundLink() {