mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 22:55:23 +00:00
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
This commit is contained in:
parent
959e04a2ff
commit
6c9c6146d8
@ -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);
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -1,10 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xul-overlay href="chrome://global/content/platformGlobalOverlay.xul"?>
|
||||
|
||||
<window id="inputBindings"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<keyset>
|
||||
<keyset id="editorKeySet">
|
||||
<key id="key_home" keycode="VK_HOME" shift="false" control="false"
|
||||
onkeypress="
|
||||
var controller =
|
||||
|
@ -8,23 +8,60 @@
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- change the xul key for Unix -->
|
||||
<keyset id="defaultKeySet" xulkey="alt">
|
||||
<keyset id="editorKeySet" xulkey="alt">
|
||||
|
||||
<!-- emacs delete keys -->
|
||||
<key id="emacsbackspacekb" key="h" control="true" onkeypress="EditorDeleteCharBackward()" />
|
||||
<key id="emacsdeletekb" key="d" control="true" onkeypress="EditorDeleteCharForward()" />
|
||||
<key id="emacsdeletewordbackwardkb" key="w" control="true" onkeypress="EditorDeleteWordBackward()" />
|
||||
<key id="emacskilltoendkb" key="k" control="true" onkeypress="EditorDeleteToEndOfLine()" />
|
||||
<key id="emDelCharBWkb" key="h" control="true" shift="false"
|
||||
onkeypress="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_deleteCharBackward');
|
||||
controller.doCommand('cmd_deleteCharBackward');"/>
|
||||
<key id="emDelCharFWkb" key="d" control="true" shift="false"
|
||||
onkeypress="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_deleteCharForward');
|
||||
controller.doCommand('cmd_deleteCharForward');"/>
|
||||
<key id="emDelWordBWkb" key="w" control="true" shift="false"
|
||||
onkeypress="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_deleteWordBackward');
|
||||
controller.doCommand('cmd_deleteWordBackward');"/>
|
||||
<key id="emKillToEndkb" key="k" control="true" shift="false"
|
||||
onkeypress="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_deleteToEndOfLine');
|
||||
controller.doCommand('cmd_deleteToEndOfLine');"/>
|
||||
|
||||
<!-- emacs motion keys: these use the selection controller API -->
|
||||
<key id="emacsbolkb" key="a" control="true" onkeypress="SelectionBeginningOfLine()" />
|
||||
<key id="emacseolkb" key="e" control="true" onkeypress="SelectionEndOfLine()" />
|
||||
<key id="emacsbackkb" key="b" control="true" onkeypress="SelectionBackwardChar()" />
|
||||
<key id="emacsforwardkb" key="f" control="true" onkeypress="SelectionForwardChar()" />
|
||||
<key id="emacsupkb" key="p" control="true" onkeypress="SelectionPreviousLine()" />
|
||||
<key id="emacsdownkb" key="n" control="true" onkeypress="SelectionNextLine()" />
|
||||
<key id="emacspagedownkb" key="v" control="true" onkeypress="SelectionPageDown()" />
|
||||
<key id="emacspageupkb" key="v" meta="true" onkeypress="SelectionPageUp()" />
|
||||
<key id="emBeginLinekb" key="a" control="true" shift="false"
|
||||
onkeypress="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_beginLine');
|
||||
controller.doCommand('cmd_beginLine');"/>
|
||||
<key id="emEndLinekb" key="e" control="true" shift="false"
|
||||
onkeypress="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_endLine');
|
||||
controller.doCommand('cmd_endLine');"/>
|
||||
<key id="emCharPrevkb" key="b" control="true" shift="false"
|
||||
onkeypress="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_charPrevious');
|
||||
controller.doCommand('cmd_charPrevious');"/>
|
||||
<key id="emCharNextkb" key="f" control="true" shift="false"
|
||||
onkeypress="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_charNext');
|
||||
controller.doCommand('cmd_charNext');"/>
|
||||
<key id="emPrevLinekb" key="p" control="true" shift="false"
|
||||
onkeypress="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_linePrevious');
|
||||
controller.doCommand('cmd_linePrevious');"/>
|
||||
<key id="emNextLinekb" key="" control="true" shift="false"
|
||||
onkeypress="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_lineNext');
|
||||
controller.doCommand('cmd_lineNext');"/>
|
||||
<key id="emPageDownkb" key="v" control="true" shift="false"
|
||||
onkeypress="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_scrollPageDown');
|
||||
controller.doCommand('cmd_scrollPageDown');"/>
|
||||
<key id="emacspagedownkb" key="v" control="true" onkeypress="SelectionPageDown()" />
|
||||
<key id="emPageUpkb" key="v" control="true" shift="false" meta="true"
|
||||
onkeypress="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_scrollPageUp');
|
||||
controller.doCommand('cmd_scrollPageUp');"/>
|
||||
|
||||
</keyset>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user