fix for 67847: forward delete can make caret go to start of doc. r=kin; sr=sfraser; a=asa

This commit is contained in:
jfrancis%netscape.com 2001-06-12 22:21:12 +00:00
parent e51b95f598
commit ce1e99c63d
4 changed files with 10 additions and 18 deletions

View File

@ -1839,10 +1839,6 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
if (endNode.get() != startNode.get())
{
// block parents the same? use default deletion
if (mHTMLEditor->HasSameBlockNodeParent(startNode, endNode)) return NS_OK;
// deleting across blocks
// are the blocks of same type?
nsCOMPtr<nsIDOMNode> leftParent;
nsCOMPtr<nsIDOMNode> rightParent;
if (IsBlockNode(startNode))
@ -1853,6 +1849,10 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
rightParent = endNode;
else
rightParent = mHTMLEditor->GetBlockNodeParent(endNode);
if (leftParent == rightParent) return NS_OK;
// deleting across blocks
// are the blocks of same type?
// are the blocks siblings?
nsCOMPtr<nsIDOMNode> leftBlockParent;

View File

@ -903,11 +903,7 @@ NS_IMETHODIMP nsPlaintextEditor::DeleteSelection(nsIEditor::EDirection aAction)
break;
case eToEndOfLine:
result = selCont->IntraLineMove(PR_TRUE, PR_TRUE);
// Bugs 54449/54452: the selection jumps to the wrong place
// when deleting past a <br> and action is eNext or ePrev,
// so setting action to eNone makes delete-to-end marginally usable.
// aAction should really be set to eNext
aAction = eNone;
aAction = eNext;
break;
default: // avoid several compiler warnings
result = NS_OK;

View File

@ -1839,10 +1839,6 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
if (endNode.get() != startNode.get())
{
// block parents the same? use default deletion
if (mHTMLEditor->HasSameBlockNodeParent(startNode, endNode)) return NS_OK;
// deleting across blocks
// are the blocks of same type?
nsCOMPtr<nsIDOMNode> leftParent;
nsCOMPtr<nsIDOMNode> rightParent;
if (IsBlockNode(startNode))
@ -1853,6 +1849,10 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
rightParent = endNode;
else
rightParent = mHTMLEditor->GetBlockNodeParent(endNode);
if (leftParent == rightParent) return NS_OK;
// deleting across blocks
// are the blocks of same type?
// are the blocks siblings?
nsCOMPtr<nsIDOMNode> leftBlockParent;

View File

@ -903,11 +903,7 @@ NS_IMETHODIMP nsPlaintextEditor::DeleteSelection(nsIEditor::EDirection aAction)
break;
case eToEndOfLine:
result = selCont->IntraLineMove(PR_TRUE, PR_TRUE);
// Bugs 54449/54452: the selection jumps to the wrong place
// when deleting past a <br> and action is eNext or ePrev,
// so setting action to eNone makes delete-to-end marginally usable.
// aAction should really be set to eNext
aAction = eNone;
aAction = eNext;
break;
default: // avoid several compiler warnings
result = NS_OK;