From 08a4571f96a05f46ada360cae39579b498129ed4 Mon Sep 17 00:00:00 2001 From: ilya Date: Mon, 30 Nov 2009 01:02:47 -0800 Subject: Fix bug where find mode HUD matched its own searches. --- vimiumFrontend.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/vimiumFrontend.js b/vimiumFrontend.js index 4edb9677..c96e4a23 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -223,13 +223,13 @@ function exitInsertMode() { function handleKeyCharForFindMode(keyChar) { findModeQuery = findModeQuery + keyChar; - HUD.show("/" + findModeQuery); + showFindModeHUDForQuery(); performFind(); } function handleDeleteForFindMode() { findModeQuery = findModeQuery.substring(0, findModeQuery.length - 1); - HUD.show("/" + findModeQuery); + showFindModeHUDForQuery(); performFind(); } @@ -246,6 +246,22 @@ function performBackwardsFind() { window.find(findModeQuery, false, true, true, false, true, false); } +function showFindModeHUDForQuery() { + HUD.show("/" + insertSpaces(findModeQuery)); +} + +/* + * We need this so that the find mode HUD doesn't match its own searches. + */ +function insertSpaces(query) { + var newQuery = ""; + + for (var i = 0; i < query.length; i++) + newQuery = newQuery + query[i] + " "; + + return newQuery; +} + function enterFindMode() { findModeQuery = ""; findMode = true; -- cgit v1.2.3