From cae1f90939aa35d8aa0664bb62fb7791e627f93a Mon Sep 17 00:00:00 2001 From: "jfrancis%netscape.com" Date: Sun, 19 Sep 1999 10:30:30 +0000 Subject: [PATCH] putting tab handling back in KeyDown(). Else editor never gets tabs. --- editor/base/nsEditorEventListeners.cpp | 22 +++++++++++++++++++ .../libeditor/text/nsEditorEventListeners.cpp | 22 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/editor/base/nsEditorEventListeners.cpp b/editor/base/nsEditorEventListeners.cpp index 6d690c5f2801..d85a611d2e3f 100644 --- a/editor/base/nsEditorEventListeners.cpp +++ b/editor/base/nsEditorEventListeners.cpp @@ -124,6 +124,28 @@ nsTextEditorKeyListener::HandleEvent(nsIDOMEvent* aEvent) nsresult nsTextEditorKeyListener::KeyDown(nsIDOMEvent* aKeyEvent) { + PRUint32 keyCode; + nsCOMPtruiEvent; + uiEvent = do_QueryInterface(aKeyEvent); + if (uiEvent) + { + if (NS_SUCCEEDED(uiEvent->GetKeyCode(&keyCode))) + { + if (nsIDOMUIEvent::VK_TAB==keyCode) + { + nsCOMPtr htmlEditor = do_QueryInterface(mEditor); + PRUint32 flags=0; + mEditor->GetFlags(&flags); + if ((flags & nsIHTMLEditor::eEditorSingleLineMask)) + return NS_OK; // let it be used for focus switching + + // else we insert the tab straight through + htmlEditor->EditorKeyPress(uiEvent); + ScrollSelectionIntoView(); + return NS_ERROR_BASE; // "I handled the event, don't do default processing" + } + } + } return NS_OK; } diff --git a/editor/libeditor/text/nsEditorEventListeners.cpp b/editor/libeditor/text/nsEditorEventListeners.cpp index 6d690c5f2801..d85a611d2e3f 100644 --- a/editor/libeditor/text/nsEditorEventListeners.cpp +++ b/editor/libeditor/text/nsEditorEventListeners.cpp @@ -124,6 +124,28 @@ nsTextEditorKeyListener::HandleEvent(nsIDOMEvent* aEvent) nsresult nsTextEditorKeyListener::KeyDown(nsIDOMEvent* aKeyEvent) { + PRUint32 keyCode; + nsCOMPtruiEvent; + uiEvent = do_QueryInterface(aKeyEvent); + if (uiEvent) + { + if (NS_SUCCEEDED(uiEvent->GetKeyCode(&keyCode))) + { + if (nsIDOMUIEvent::VK_TAB==keyCode) + { + nsCOMPtr htmlEditor = do_QueryInterface(mEditor); + PRUint32 flags=0; + mEditor->GetFlags(&flags); + if ((flags & nsIHTMLEditor::eEditorSingleLineMask)) + return NS_OK; // let it be used for focus switching + + // else we insert the tab straight through + htmlEditor->EditorKeyPress(uiEvent); + ScrollSelectionIntoView(); + return NS_ERROR_BASE; // "I handled the event, don't do default processing" + } + } + } return NS_OK; }