1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-23 14:45:47 +01:00

Make */# more robust.

Will now always go to the next match instead of sometimes skipping and
sometimes staying in the same place.
This commit is contained in:
Conrad Irwin
2009-04-05 12:58:10 +01:00
parent 73e35da652
commit 7ace135ebb

View File

@@ -316,8 +316,10 @@ function Search() //{{{
function () function ()
{ {
found = false; found = false;
search.searchSubmitted(buffer.getCurrentWord(), false); let word = buffer.getCurrentWord();
search.findAgain(); // A hacky way to move after the current match before searching forwards
window.content.getSelection().getRangeAt(0).collapse(false);
search.searchSubmitted(word, false)
}); });
mappings.add(myModes.concat([modes.CARET, modes.TEXTAREA]), ["#"], mappings.add(myModes.concat([modes.CARET, modes.TEXTAREA]), ["#"],
@@ -325,8 +327,10 @@ function Search() //{{{
function () function ()
{ {
found = false; found = false;
search.searchSubmitted(buffer.getCurrentWord(), true); let word = buffer.getCurrentWord();
search.findAgain(); // A hacky way to move before the current match before searching backwards
window.content.getSelection().getRangeAt(0).collapse(true);
search.searchSubmitted(word, true)
}); });
/////////////////////////////////////////////////////////////////////////////}}} /////////////////////////////////////////////////////////////////////////////}}}
@@ -458,7 +462,7 @@ function Search() //{{{
backwards = forcedBackward; backwards = forcedBackward;
//Allow /<CR> to work. //Allow /<CR> to work.
if (!command) if ((!command) || command == lastSearchPattern)
return this.findAgain(backwards != lastSearchBackwards) return this.findAgain(backwards != lastSearchBackwards)
this.clear(); this.clear();