From 1fadcdc94dfd1a765cc69f419fc0038da799838e Mon Sep 17 00:00:00 2001 From: "ftang@netscape.com" Date: Wed, 27 Oct 1999 22:56:36 +0000 Subject: [PATCH] add debugging code. fix remove last uncomited IMEText. r=jfrancis --- editor/base/nsEditorEventListeners.cpp | 15 +++++++++++++++ editor/base/nsHTMLEditRules.cpp | 10 ++++++++++ editor/base/nsTextEditRules.cpp | 3 +++ editor/libeditor/html/nsHTMLEditRules.cpp | 10 ++++++++++ editor/libeditor/text/nsEditorEventListeners.cpp | 15 +++++++++++++++ editor/libeditor/text/nsTextEditRules.cpp | 3 +++ 6 files changed, 56 insertions(+) diff --git a/editor/base/nsEditorEventListeners.cpp b/editor/base/nsEditorEventListeners.cpp index aa768086bffd..8cd3cb13fee2 100644 --- a/editor/base/nsEditorEventListeners.cpp +++ b/editor/base/nsEditorEventListeners.cpp @@ -731,6 +731,9 @@ nsTextEditorTextListener::QueryInterface(REFNSIID aIID, void** aInstancePtr) nsresult nsTextEditorTextListener::HandleEvent(nsIDOMEvent* aEvent) { +#if defined(DEBUG_ftang) + printf("nsTextEditorTextListener::HandleEvent\n"); +#endif return NS_OK; } @@ -739,6 +742,9 @@ nsTextEditorTextListener::HandleEvent(nsIDOMEvent* aEvent) nsresult nsTextEditorTextListener::HandleText(nsIDOMEvent* aTextEvent) { +#if defined(DEBUG_ftang) + printf("nsTextEditorTextListener::HandleText\n"); +#endif nsAutoString composedText; nsresult result = NS_OK; nsCOMPtr textEvent; @@ -975,6 +981,9 @@ NS_IMPL_RELEASE(nsTextEditorCompositionListener) nsresult nsTextEditorCompositionListener::HandleEvent(nsIDOMEvent* aEvent) { +#if defined(DEBUG_ftang) + printf("nsTextEditorCompositionListener::HandleEvent\n"); +#endif return NS_OK; } @@ -990,6 +999,9 @@ void nsTextEditorCompositionListener::SetEditor(nsIEditor *aEditor) nsresult nsTextEditorCompositionListener::HandleStartComposition(nsIDOMEvent* aCompositionEvent) { +#if defined(DEBUG_ftang) + printf("nsTextEditorCompositionListener::HandleStartComposition\n"); +#endif nsCOMPtr pCompositionEvent = do_QueryInterface(aCompositionEvent); nsTextEventReply* eventReply; @@ -1004,6 +1016,9 @@ nsTextEditorCompositionListener::HandleStartComposition(nsIDOMEvent* aCompositio nsresult nsTextEditorCompositionListener::HandleEndComposition(nsIDOMEvent* aCompositionEvent) { +#if defined(DEBUG_ftang) + printf("nsTextEditorCompositionListener::HandleEndComposition\n"); +#endif return mEditor->EndComposition(); } diff --git a/editor/base/nsHTMLEditRules.cpp b/editor/base/nsHTMLEditRules.cpp index d77780401c61..9ebc493e727d 100644 --- a/editor/base/nsHTMLEditRules.cpp +++ b/editor/base/nsHTMLEditRules.cpp @@ -78,6 +78,9 @@ nsHTMLEditRules::WillDoAction(nsIDOMSelection *aSelection, { if (!aInfo || !aCancel || !aHandled) return NS_ERROR_NULL_POINTER; +#if defined(DEBUG_ftang) + printf("nsHTMLEditRules::WillDoAction action = %d\n", aInfo->action); +#endif *aCancel = PR_FALSE; *aHandled = PR_FALSE; @@ -271,6 +274,13 @@ nsHTMLEditRules::WillInsertText(nsIDOMSelection *aSelection, nsString theString(*inString); // copy instring for now PRInt32 pos = theString.FindCharInSet(specialChars); + if(0 == theString.Length()) { + // special case for IME. We need this to remove the last + // unconverted text. + PRBool bCancel; + nsString partialString; + res = DoTextInsertion(aSelection, &bCancel, &partialString, typeInState); + } while (theString.Length()) { PRBool bCancel; diff --git a/editor/base/nsTextEditRules.cpp b/editor/base/nsTextEditRules.cpp index 27ea87c1cfb0..6467866e13f5 100644 --- a/editor/base/nsTextEditRules.cpp +++ b/editor/base/nsTextEditRules.cpp @@ -127,6 +127,9 @@ nsTextEditRules::WillDoAction(nsIDOMSelection *aSelection, { // null selection is legal if (!aInfo || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; } +#if defined(DEBUG_ftang) + printf("nsTextEditRules::WillDoAction action= %d", aInfo->action); +#endif *aCancel = PR_FALSE; *aHandled = PR_FALSE; diff --git a/editor/libeditor/html/nsHTMLEditRules.cpp b/editor/libeditor/html/nsHTMLEditRules.cpp index d77780401c61..9ebc493e727d 100644 --- a/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/editor/libeditor/html/nsHTMLEditRules.cpp @@ -78,6 +78,9 @@ nsHTMLEditRules::WillDoAction(nsIDOMSelection *aSelection, { if (!aInfo || !aCancel || !aHandled) return NS_ERROR_NULL_POINTER; +#if defined(DEBUG_ftang) + printf("nsHTMLEditRules::WillDoAction action = %d\n", aInfo->action); +#endif *aCancel = PR_FALSE; *aHandled = PR_FALSE; @@ -271,6 +274,13 @@ nsHTMLEditRules::WillInsertText(nsIDOMSelection *aSelection, nsString theString(*inString); // copy instring for now PRInt32 pos = theString.FindCharInSet(specialChars); + if(0 == theString.Length()) { + // special case for IME. We need this to remove the last + // unconverted text. + PRBool bCancel; + nsString partialString; + res = DoTextInsertion(aSelection, &bCancel, &partialString, typeInState); + } while (theString.Length()) { PRBool bCancel; diff --git a/editor/libeditor/text/nsEditorEventListeners.cpp b/editor/libeditor/text/nsEditorEventListeners.cpp index aa768086bffd..8cd3cb13fee2 100644 --- a/editor/libeditor/text/nsEditorEventListeners.cpp +++ b/editor/libeditor/text/nsEditorEventListeners.cpp @@ -731,6 +731,9 @@ nsTextEditorTextListener::QueryInterface(REFNSIID aIID, void** aInstancePtr) nsresult nsTextEditorTextListener::HandleEvent(nsIDOMEvent* aEvent) { +#if defined(DEBUG_ftang) + printf("nsTextEditorTextListener::HandleEvent\n"); +#endif return NS_OK; } @@ -739,6 +742,9 @@ nsTextEditorTextListener::HandleEvent(nsIDOMEvent* aEvent) nsresult nsTextEditorTextListener::HandleText(nsIDOMEvent* aTextEvent) { +#if defined(DEBUG_ftang) + printf("nsTextEditorTextListener::HandleText\n"); +#endif nsAutoString composedText; nsresult result = NS_OK; nsCOMPtr textEvent; @@ -975,6 +981,9 @@ NS_IMPL_RELEASE(nsTextEditorCompositionListener) nsresult nsTextEditorCompositionListener::HandleEvent(nsIDOMEvent* aEvent) { +#if defined(DEBUG_ftang) + printf("nsTextEditorCompositionListener::HandleEvent\n"); +#endif return NS_OK; } @@ -990,6 +999,9 @@ void nsTextEditorCompositionListener::SetEditor(nsIEditor *aEditor) nsresult nsTextEditorCompositionListener::HandleStartComposition(nsIDOMEvent* aCompositionEvent) { +#if defined(DEBUG_ftang) + printf("nsTextEditorCompositionListener::HandleStartComposition\n"); +#endif nsCOMPtr pCompositionEvent = do_QueryInterface(aCompositionEvent); nsTextEventReply* eventReply; @@ -1004,6 +1016,9 @@ nsTextEditorCompositionListener::HandleStartComposition(nsIDOMEvent* aCompositio nsresult nsTextEditorCompositionListener::HandleEndComposition(nsIDOMEvent* aCompositionEvent) { +#if defined(DEBUG_ftang) + printf("nsTextEditorCompositionListener::HandleEndComposition\n"); +#endif return mEditor->EndComposition(); } diff --git a/editor/libeditor/text/nsTextEditRules.cpp b/editor/libeditor/text/nsTextEditRules.cpp index 27ea87c1cfb0..6467866e13f5 100644 --- a/editor/libeditor/text/nsTextEditRules.cpp +++ b/editor/libeditor/text/nsTextEditRules.cpp @@ -127,6 +127,9 @@ nsTextEditRules::WillDoAction(nsIDOMSelection *aSelection, { // null selection is legal if (!aInfo || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; } +#if defined(DEBUG_ftang) + printf("nsTextEditRules::WillDoAction action= %d", aInfo->action); +#endif *aCancel = PR_FALSE; *aHandled = PR_FALSE;