fixed selection results after bold/italics. 4593 bug. simply collapsed range and extended it to take up the whole new range

This commit is contained in:
mjudge%netscape.com 1999-04-08 01:30:05 +00:00
parent 0f03b6a5f0
commit 54aef1837f

View File

@ -1053,6 +1053,15 @@ NS_IMETHODIMP nsTextEditor::SetTextPropertiesForNode(nsIDOMNode *aNode,
result = nsEditor::DeleteNode(newTextNode);
if (NS_SUCCEEDED(result)) {
result = nsEditor::InsertNode(newTextNode, newStyleNode, 0);
if (NS_SUCCEEDED(result)) {
nsCOMPtr<nsIDOMSelection>selection;
result = nsEditor::GetSelection(getter_AddRefs(selection));
if (NS_SUCCEEDED(result)) {
selection->Collapse(newTextNode, 0);
PRInt32 endOffset = aEndOffset-aStartOffset;
selection->Extend(newTextNode, endOffset);
}
}
}
}
}