Bug 246237: Fix various navigation key + autoFill issues. Patch by pkasting@google.com, r=mconnor, sr+a181=benjamin

This commit is contained in:
pamg.bugs%gmail.com 2006-06-15 21:53:09 +00:00
Родитель 84b26ca512
Коммит 0db7c90051
1 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -461,13 +461,21 @@ nsAutoCompleteController::HandleKeyNavigation(PRUint16 aKey, PRBool *_retval)
if (selectedIndex >= 0) {
// The pop-up is open and has a selection, take its value
nsAutoString value;
if (NS_SUCCEEDED(GetResultValueAt(selectedIndex, PR_TRUE, value)))
CompleteValue(value, PR_FALSE);
if (NS_SUCCEEDED(GetResultValueAt(selectedIndex, PR_TRUE, value))) {
mInput->SetTextValue(value);
mInput->SelectTextRange(value.Length(), value.Length());
}
}
// Close the pop-up even if nothing was selected
ClearSearchTimer();
ClosePopup();
}
// Update last-searched string to the current input, since the input may
// have changed. Without this, subsequent backspaces look like text
// additions, not text deletions.
nsAutoString value;
mInput->GetTextValue(value);
mSearchString = value;
}
return NS_OK;
@ -1106,8 +1114,6 @@ nsAutoCompleteController::RevertTextValue()
if (!cancel)
mInput->SetTextValue(oldValue);
mSearchString.Truncate(0);
return NS_OK;
}