mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-05 05:05:45 +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:
@@ -316,8 +316,10 @@ function Search() //{{{
|
||||
function ()
|
||||
{
|
||||
found = false;
|
||||
search.searchSubmitted(buffer.getCurrentWord(), false);
|
||||
search.findAgain();
|
||||
let word = buffer.getCurrentWord();
|
||||
// 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]), ["#"],
|
||||
@@ -325,8 +327,10 @@ function Search() //{{{
|
||||
function ()
|
||||
{
|
||||
found = false;
|
||||
search.searchSubmitted(buffer.getCurrentWord(), true);
|
||||
search.findAgain();
|
||||
let word = buffer.getCurrentWord();
|
||||
// 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;
|
||||
|
||||
//Allow /<CR> to work.
|
||||
if (!command)
|
||||
if ((!command) || command == lastSearchPattern)
|
||||
return this.findAgain(backwards != lastSearchBackwards)
|
||||
|
||||
this.clear();
|
||||
|
||||
Reference in New Issue
Block a user