Fix for bug 101690: Delete key at end of line deletes a line then caret freezes

Modified WillDeleteSelection() to make sure that
sibling is a TextNode before trying to join it
with startNode (which is guaranteed to be a text node).

r=jfrancis@netscape.com   sr=sfraser@netscape.com
This commit is contained in:
kin%netscape.com 2001-10-19 13:48:43 +00:00
parent 57dc85bacc
commit b27b16b597

View File

@ -1667,7 +1667,7 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
res = nsWSRunObject::PrepareToDeleteNode(mHTMLEditor, nextNode);
if (NS_FAILED(res)) return res;
}
// remember prior sibling to prior node, if any
// remember next sibling after nextNode, if any
nsCOMPtr<nsIDOMNode> sibling, stepbrother;
mHTMLEditor->GetNextHTMLSibling(nextNode, address_of(sibling));
// delete the break, and join like nodes if appropriate
@ -1681,7 +1681,7 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
if (startNode == stepbrother)
{
// are they same type?
if (mHTMLEditor->IsTextNode(stepbrother))
if (mHTMLEditor->IsTextNode(sibling))
{
// if so, join them!
res = JoinNodesSmart(startNode, sibling, address_of(selNode), &selOffset);