зеркало из https://github.com/mozilla/pjs.git
bug 290172 - pressing left or right arrow key in location bar causes refresh, patch by Mark Mentovai (mark@moxienet.com), r=me, a=asa
This commit is contained in:
Родитель
e086bd155f
Коммит
344ce8b606
|
@ -424,8 +424,22 @@ nsAutoCompleteController::HandleKeyNavigation(PRUint16 aKey, PRBool *_retval)
|
|||
} else if (aKey == nsIAutoCompleteController::KEY_LEFT ||
|
||||
aKey == nsIAutoCompleteController::KEY_RIGHT)
|
||||
{
|
||||
// When the user arrows to the side select that value and close the popup
|
||||
HandleEnter(_retval);
|
||||
// The user hit a left or right arrow key
|
||||
PRBool isOpen;
|
||||
mInput->GetPopupOpen(&isOpen);
|
||||
if (isOpen) {
|
||||
PRInt32 selectedIndex;
|
||||
popup->GetSelectedIndex(&selectedIndex);
|
||||
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);
|
||||
}
|
||||
// Close the pop-up even if nothing was selected
|
||||
ClearSearchTimer();
|
||||
ClosePopup();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1147,7 +1161,7 @@ nsAutoCompleteController::CompleteValue(nsString &aValue, PRBool selectDifferenc
|
|||
iter = start;
|
||||
|
||||
FindInReadable(mSearchString, iter, end,
|
||||
nsCaseInsensitiveStringComparator());
|
||||
nsCaseInsensitiveStringComparator());
|
||||
|
||||
if (iter == start) {
|
||||
// The textbox value matches the beginning of the default value,
|
||||
|
|
Загрузка…
Ссылка в новой задаче