fixes for hint code

This commit is contained in:
mjudge%netscape.com 1999-09-22 04:11:38 +00:00
parent dab7bc1010
commit a59a53609b

View File

@ -814,23 +814,27 @@ nsRangeList::HandleKeyEvent(nsGUIEvent *aGuiEvent)
return result; return result;
nsPeekOffsetStruct pos; nsPeekOffsetStruct pos;
pos.SetData(mTracker, desiredX, amount, eDirPrevious, offsetused, PR_FALSE,PR_TRUE); pos.SetData(mTracker, desiredX, amount, eDirPrevious, offsetused, PR_FALSE,PR_TRUE);
mHint = HINTRIGHT;//stick to opposite of movement
switch (keyEvent->keyCode){ switch (keyEvent->keyCode){
case nsIDOMUIEvent::DOM_VK_RIGHT : case nsIDOMUIEvent::DOM_VK_RIGHT :
InvalidateDesiredX();
pos.mDirection = eDirNext; pos.mDirection = eDirNext;
mHint = HINTLEFT;//stick to this line mHint = HINTLEFT;//stick to this line
break;
case nsIDOMUIEvent::DOM_VK_LEFT : //no break case nsIDOMUIEvent::DOM_VK_LEFT : //no break
InvalidateDesiredX(); InvalidateDesiredX();
mHint = HINTRIGHT;//stick to opposite of movement
break; break;
case nsIDOMUIEvent::DOM_VK_DOWN : case nsIDOMUIEvent::DOM_VK_DOWN :
pos.mAmount = eSelectLine;
pos.mDirection = eDirNext;//no break here pos.mDirection = eDirNext;//no break here
mHint = HINTLEFT;//stick to this line break;
case nsIDOMUIEvent::DOM_VK_UP : case nsIDOMUIEvent::DOM_VK_UP :
pos.mAmount = eSelectLine; pos.mAmount = eSelectLine;
break; break;
case nsIDOMUIEvent::DOM_VK_HOME : case nsIDOMUIEvent::DOM_VK_HOME :
pos.mAmount = eSelectBeginLine; pos.mAmount = eSelectBeginLine;
InvalidateDesiredX(); InvalidateDesiredX();
mHint = HINTRIGHT;//stick to opposite of movement
break; break;
case nsIDOMUIEvent::DOM_VK_END : case nsIDOMUIEvent::DOM_VK_END :
pos.mAmount = eSelectEndLine; pos.mAmount = eSelectEndLine;
@ -841,7 +845,10 @@ nsRangeList::HandleKeyEvent(nsGUIEvent *aGuiEvent)
} }
pos.mPreferLeft = mHint; pos.mPreferLeft = mHint;
if (NS_SUCCEEDED(result) && NS_SUCCEEDED(frame->PeekOffset(&pos)) && pos.mResultContent) if (NS_SUCCEEDED(result) && NS_SUCCEEDED(frame->PeekOffset(&pos)) && pos.mResultContent)
{
mHint = (HINT)pos.mPreferLeft;
result = TakeFocus(pos.mResultContent, pos.mContentOffset, pos.mContentOffset, keyEvent->isShift, PR_FALSE); result = TakeFocus(pos.mResultContent, pos.mContentOffset, pos.mContentOffset, keyEvent->isShift, PR_FALSE);
}
if (NS_SUCCEEDED(result)) if (NS_SUCCEEDED(result))
result = mDomSelections[SELECTION_NORMAL]->ScrollIntoView(); result = mDomSelections[SELECTION_NORMAL]->ScrollIntoView();