From 6c9c6146d8f6db2721ff9cd09763117aee7b97bb Mon Sep 17 00:00:00 2001 From: "akkana%netscape.com" Date: Sat, 11 Dec 1999 01:28:07 +0000 Subject: [PATCH] 18033, 19981: Adjust inputBindings keyset so that it can be overlaid with platformGlobalOverlay.xul. Rewrite emacs keybindings in the unix overlay to track mjudge's latest changes. r=mjudge, a=jar --- .../html/content/src/nsEditorController.cpp | 40 +++++++++++- layout/html/content/src/nsEditorController.h | 6 ++ .../resources/content/inputBindings.xul | 3 +- .../content/unix/platformGlobalOverlay.xul | 63 +++++++++++++++---- 4 files changed, 97 insertions(+), 15 deletions(-) diff --git a/layout/html/content/src/nsEditorController.cpp b/layout/html/content/src/nsEditorController.cpp index b9b388ba8c7f..e0e98eefccd4 100644 --- a/layout/html/content/src/nsEditorController.cpp +++ b/layout/html/content/src/nsEditorController.cpp @@ -46,9 +46,9 @@ nsEditorController::nsEditorController() mCutString = "cmd_cut"; mCopyString = "cmd_copy"; mPasteString = "cmd_paste"; + mDeleteString = "cmd_delete"; mSelectAllString = "cmd_selectAll"; - mBeginLineString = "cmd_beginLine"; mEndLineString = "cmd_endLine"; mSelectBeginLineString = "cmd_selectBeginLine"; @@ -85,6 +85,12 @@ nsEditorController::nsEditorController() mMovePageDown = "cmd_scrollPageDown"; mSelectMovePageUp = "cmd_selectPageUp"; mSelectMovePageDown = "cmd_selectPageDown"; + + mDeleteCharBackward = "cmd_deleteCharBackward"; + mDeleteCharForward = "cmd_deleteCharForward"; + mDeleteWordBackward = "cmd_deleteWordBackward"; + mDeleteWordForward = "cmd_deleteWordForward"; + mDeleteToEndOfLine = "cmd_deleteToEndOfLine"; } nsEditorController::~nsEditorController() @@ -193,6 +199,11 @@ NS_IMETHODIMP nsEditorController::SupportsCommand(const PRUnichar *aCommand, PRB (PR_TRUE==mCopyString.Equals(aCommand)) || (PR_TRUE==mPasteString.Equals(aCommand)) || (PR_TRUE==mDeleteString.Equals(aCommand)) || + (PR_TRUE==mDeleteCharForward.Equals(aCommand)) || + (PR_TRUE==mDeleteCharBackward.Equals(aCommand)) || + (PR_TRUE==mDeleteWordForward.Equals(aCommand)) || + (PR_TRUE==mDeleteWordBackward.Equals(aCommand)) || + (PR_TRUE==mDeleteToEndOfLine.Equals(aCommand)) || (PR_TRUE==mSelectAllString.Equals(aCommand)) || (PR_TRUE==mBeginLineString.Equals(aCommand)) || (PR_TRUE==mEndLineString.Equals(aCommand)) || @@ -270,6 +281,33 @@ NS_IMETHODIMP nsEditorController::DoCommand(const PRUnichar *aCommand) { NS_ENSURE_SUCCESS(editor->SelectAll(), NS_ERROR_FAILURE); } + + else if (PR_TRUE==mDeleteCharForward.Equals(aCommand)) + { + NS_ENSURE_SUCCESS(editor->DeleteSelection(nsIEditor::eNext), + NS_ERROR_FAILURE); + } + else if (PR_TRUE==mDeleteCharBackward.Equals(aCommand)) + { + NS_ENSURE_SUCCESS(editor->DeleteSelection(nsIEditor::ePrevious), + NS_ERROR_FAILURE); + } + else if (PR_TRUE==mDeleteWordForward.Equals(aCommand)) + { + NS_ENSURE_SUCCESS(editor->DeleteSelection(nsIEditor::eNextWord), + NS_ERROR_FAILURE); + } + else if (PR_TRUE==mDeleteWordBackward.Equals(aCommand)) + { + NS_ENSURE_SUCCESS(editor->DeleteSelection(nsIEditor::ePreviousWord), + NS_ERROR_FAILURE); + } + else if (PR_TRUE==mDeleteToEndOfLine.Equals(aCommand)) + { + NS_ENSURE_SUCCESS(editor->DeleteSelection(nsIEditor::eToEndOfLine), + NS_ERROR_FAILURE); + } + else if (PR_TRUE==mScrollTopString.Equals(aCommand)) //ScrollTOP { NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE); diff --git a/layout/html/content/src/nsEditorController.h b/layout/html/content/src/nsEditorController.h index 5bb3aefbbf0b..96dcd9b3e5d7 100644 --- a/layout/html/content/src/nsEditorController.h +++ b/layout/html/content/src/nsEditorController.h @@ -105,6 +105,12 @@ protected: nsString mSelectMovePageUp; nsString mSelectMovePageDown; + nsString mDeleteCharBackward; + nsString mDeleteCharForward; + nsString mDeleteWordBackward; + nsString mDeleteWordForward; + nsString mDeleteToEndOfLine; + protected: nsIHTMLContent* mContent; // weak reference, the content object owns this object }; diff --git a/xpfe/global/resources/content/inputBindings.xul b/xpfe/global/resources/content/inputBindings.xul index 3174a027980a..033ceb55b2e5 100644 --- a/xpfe/global/resources/content/inputBindings.xul +++ b/xpfe/global/resources/content/inputBindings.xul @@ -1,10 +1,11 @@ + - + - + - - - - + + + + - - - - - - - - + + + + + + + + +