1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 10:47:59 +01:00

fixed some hints problem

This commit is contained in:
Martin Stubenschrott
2008-05-17 14:54:10 +00:00
parent c9cbedf439
commit 8a1162349a
2 changed files with 71 additions and 9 deletions

View File

@@ -404,21 +404,75 @@ liberator.Hints = function () //{{{
function charsAtBeginningOfWords(chars, words, allowWordOverleaping)
{
var charIdx = 0;
var numMatchedWords = 0;
for (var wIdx = 0; wIdx < words.length; wIdx++)
{
var word = words[wIdx];
if (word.length == 0)
continue;
var prevCharIdx = charIdx;
for (var j = 0; j < word.length && charIdx < chars.length; j++, charIdx++)
var wcIdx = 0;
// Check if the current word matches same characters as the previous word.
// Each already matched word has matched at least one character.
if (charIdx > numMatchedWords)
{
if (word[j] != chars[charIdx])
var matchingStarted = false;
for (var i = numMatchedWords; i < charIdx; i++)
{
if (chars[i] == word[wcIdx])
{
matchingStarted = true;
wcIdx++;
}
else if (matchingStarted)
{
wcIdx = 0;
break;
}
}
}
// the current word matches same characters as the previous word
if (wcIdx > 0) {
var prevCharIdx = charIdx;
// now check if it matches additional characters
for (; wcIdx < word.length && charIdx < chars.length; wcIdx++, charIdx++)
{
if (word[wcIdx] != chars[charIdx])
break;
}
if (prevCharIdx == charIdx && ! allowWordOverleaping)
// the word doesn't match additional characters, now check if the
// already matched characters are equal to the next characters for matching,
// if yes, then consume them
if (prevCharIdx == charIdx)
{
for (var i = 0; i < wcIdx && charIdx < chars.length; i++, charIdx++)
{
if (word[i] != chars[charIdx])
break;
}
}
numMatchedWords++;
}
// the current word doesn't match same characters as the previous word, just
// try to match the next characters
else {
var prevCharIdx = charIdx;
for (var i = 0; i < word.length && charIdx < chars.length; i++, charIdx++)
{
if (word[i] != chars[charIdx])
break;
}
if (prevCharIdx == charIdx) {
if (! allowWordOverleaping)
return false;
}
else
numMatchedWords++;
}
if (charIdx == chars.length)
return true;

View File

@@ -95,6 +95,7 @@ all Firefox preferences work, because Vimperator overrides some key
bindings and changes Firefox's GUI.
________________________________________________________________________________
|:prefs!| |:preferences!|
||:pref[erences]!||
________________________________________________________________________________
@@ -103,6 +104,14 @@ preferences.
________________________________________________________________________________
|:set-!|
||:se[t]! {preference}={value}|| +
________________________________________________________________________________
Change any Firefox {preference} (those in the about:config window). You can also
reset/delete those preferences with [c]:set! {preference}&[c].
________________________________________________________________________________
section:List{nbsp}of{nbsp}options[list-options]
|\'act'| |\'activate'|
@@ -228,7 +237,6 @@ ____
A regex which defines the word separators which are used for the 'hintmatching' types
'wordstartswith' and 'firstletters' to split the words in the text of a link. +
NOTE: Because 'wordseparators' is a string, each backspace has to be quoted by another backspace.
____