From 8f13e2f0b2d97580e14d14fe5f4a95215c1a1d13 Mon Sep 17 00:00:00 2001 From: "akkana%netscape.com" Date: Tue, 14 Mar 2000 02:58:14 +0000 Subject: [PATCH] 25645, fix delete line and kill to end --- editor/base/nsHTMLEditor.cpp | 18 ++++++++++-------- editor/libeditor/html/nsHTMLEditor.cpp | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/editor/base/nsHTMLEditor.cpp b/editor/base/nsHTMLEditor.cpp index 6596efa5395e..4a68cb01bbc3 100644 --- a/editor/base/nsHTMLEditor.cpp +++ b/editor/base/nsHTMLEditor.cpp @@ -1450,6 +1450,7 @@ NS_IMETHODIMP nsHTMLEditor::DeleteSelection(nsIEditor::EDirection aAction) nsCOMPtr selection; PRBool cancel, handled; + nsresult result; // If it's one of these modes, // we have to extend the selection first. @@ -1464,7 +1465,6 @@ NS_IMETHODIMP nsHTMLEditor::DeleteSelection(nsIEditor::EDirection aAction) if (!selCont) return NS_ERROR_NO_INTERFACE; - nsresult result; switch (aAction) { case eNextWord: @@ -1478,12 +1478,13 @@ NS_IMETHODIMP nsHTMLEditor::DeleteSelection(nsIEditor::EDirection aAction) aAction = eNone; break; case eToBeginningOfLine: - result = selCont->IntraLineMove(PR_FALSE, PR_TRUE); + selCont->IntraLineMove(PR_TRUE, PR_FALSE); // try to move to end + result = selCont->IntraLineMove(PR_FALSE, PR_TRUE); // select to beginning aAction = eNone; break; case eToEndOfLine: result = selCont->IntraLineMove(PR_TRUE, PR_TRUE); - aAction = eNone; + aAction = eNext; break; default: // avoid several compiler warnings result = NS_OK; @@ -1503,7 +1504,7 @@ NS_IMETHODIMP nsHTMLEditor::DeleteSelection(nsIEditor::EDirection aAction) nsAutoRules beginRulesSniffing(this, kOpDeleteSelection, aAction); // pre-process - nsresult result = GetSelection(getter_AddRefs(selection)); + result = GetSelection(getter_AddRefs(selection)); if (NS_FAILED(result)) return result; if (!selection) return NS_ERROR_NULL_POINTER; @@ -3464,8 +3465,10 @@ NS_IMETHODIMP nsHTMLEditor::SetBodyWrapWidth(PRInt32 aWrapColumn) } // Make sure we have fixed-width font. This should be done for us, - // but it isn't, see bug 22502:, so we have to add "font: monospace;". - styleValue.Append("font-family: monospace; "); + // but it isn't, see bug 22502, so we have to add "font: monospace;". + // Only do this if we're wrapping. + if (aWrapColumn >= 0) + styleValue.Append("font-family: monospace; "); // and now we're ready to set the new whitespace/wrapping style. if (aWrapColumn > 0) // Wrap to a fixed column @@ -3778,8 +3781,6 @@ NS_IMETHODIMP nsHTMLEditor::CanCut(PRBool &aCanCut) NS_IMETHODIMP nsHTMLEditor::Copy() { - //printf("nsEditor::Copy\n"); - if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED; nsCOMPtr ps = do_QueryReferent(mPresShellWeak); if (!ps) return NS_ERROR_NOT_INITIALIZED; @@ -4081,6 +4082,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertAsPlaintextQuotation(const nsString& aQuotedText, nsIDOMNode **aNodeInserted) { + printf("InsertAsPlaintextQuotation(%s)\n", aQuotedText.ToNewCString()); // We have the text. Cite it appropriately: nsCOMPtr citer; nsresult rv; diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index 6596efa5395e..4a68cb01bbc3 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -1450,6 +1450,7 @@ NS_IMETHODIMP nsHTMLEditor::DeleteSelection(nsIEditor::EDirection aAction) nsCOMPtr selection; PRBool cancel, handled; + nsresult result; // If it's one of these modes, // we have to extend the selection first. @@ -1464,7 +1465,6 @@ NS_IMETHODIMP nsHTMLEditor::DeleteSelection(nsIEditor::EDirection aAction) if (!selCont) return NS_ERROR_NO_INTERFACE; - nsresult result; switch (aAction) { case eNextWord: @@ -1478,12 +1478,13 @@ NS_IMETHODIMP nsHTMLEditor::DeleteSelection(nsIEditor::EDirection aAction) aAction = eNone; break; case eToBeginningOfLine: - result = selCont->IntraLineMove(PR_FALSE, PR_TRUE); + selCont->IntraLineMove(PR_TRUE, PR_FALSE); // try to move to end + result = selCont->IntraLineMove(PR_FALSE, PR_TRUE); // select to beginning aAction = eNone; break; case eToEndOfLine: result = selCont->IntraLineMove(PR_TRUE, PR_TRUE); - aAction = eNone; + aAction = eNext; break; default: // avoid several compiler warnings result = NS_OK; @@ -1503,7 +1504,7 @@ NS_IMETHODIMP nsHTMLEditor::DeleteSelection(nsIEditor::EDirection aAction) nsAutoRules beginRulesSniffing(this, kOpDeleteSelection, aAction); // pre-process - nsresult result = GetSelection(getter_AddRefs(selection)); + result = GetSelection(getter_AddRefs(selection)); if (NS_FAILED(result)) return result; if (!selection) return NS_ERROR_NULL_POINTER; @@ -3464,8 +3465,10 @@ NS_IMETHODIMP nsHTMLEditor::SetBodyWrapWidth(PRInt32 aWrapColumn) } // Make sure we have fixed-width font. This should be done for us, - // but it isn't, see bug 22502:, so we have to add "font: monospace;". - styleValue.Append("font-family: monospace; "); + // but it isn't, see bug 22502, so we have to add "font: monospace;". + // Only do this if we're wrapping. + if (aWrapColumn >= 0) + styleValue.Append("font-family: monospace; "); // and now we're ready to set the new whitespace/wrapping style. if (aWrapColumn > 0) // Wrap to a fixed column @@ -3778,8 +3781,6 @@ NS_IMETHODIMP nsHTMLEditor::CanCut(PRBool &aCanCut) NS_IMETHODIMP nsHTMLEditor::Copy() { - //printf("nsEditor::Copy\n"); - if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED; nsCOMPtr ps = do_QueryReferent(mPresShellWeak); if (!ps) return NS_ERROR_NOT_INITIALIZED; @@ -4081,6 +4082,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertAsPlaintextQuotation(const nsString& aQuotedText, nsIDOMNode **aNodeInserted) { + printf("InsertAsPlaintextQuotation(%s)\n", aQuotedText.ToNewCString()); // We have the text. Cite it appropriately: nsCOMPtr citer; nsresult rv;