18033: Emacs XBL key bindings for unix. r=hyatt

This commit is contained in:
akkana%netscape.com 2000-01-31 23:47:40 +00:00
parent 8424ac3d64
commit 65781a368d
4 changed files with 75 additions and 6 deletions

View File

@ -215,6 +215,8 @@ nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
// XXX Eventually pick up using CSS3 key-equivalent property or somesuch
#ifdef XP_MAC
aKeyEvent->GetMetaKey(&isModifierPresent);
#elif XP_UNIX
aKeyEvent->GetAltKey(&isModifierPresent);
#else
aKeyEvent->GetCtrlKey(&isModifierPresent);
#endif

View File

@ -215,6 +215,8 @@ nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
// XXX Eventually pick up using CSS3 key-equivalent property or somesuch
#ifdef XP_MAC
aKeyEvent->GetMetaKey(&isModifierPresent);
#elif XP_UNIX
aKeyEvent->GetAltKey(&isModifierPresent);
#else
aKeyEvent->GetCtrlKey(&isModifierPresent);
#endif

View File

@ -414,11 +414,9 @@ nsXULKeyListenerImpl::Init(
// Set the default for the xul key modifier
#ifdef XP_MAC
mXULKeyModifier = xulKeyMeta;
#else
// Based off current UI newsgroup discussions, it looks like CTRL is
// the preferred default for UNIX. This will of course be configurable
// so that ALT can be chosen by those who favor it, but CTRL will be
// the default.
#elif XP_UNIX
mXULKeyModifier = xulKeyAlt;
#else
mXULKeyModifier = xulKeyControl;
#endif
return NS_OK;

View File

@ -6,12 +6,79 @@
<binding name="inputFields" extends="resource:/chrome/htmlBindings.xml#inputFieldsBase">
<handlers>
<!-- Emacsish single-line motion and delete keys -->
<handler type="keypress" id="key_home" key="a" control="true"
command="cmd_beginLine"/>
<handler type="keypress" id="key_end" key="e" control="true"
command="cmd_endLine"/>
<handler type="keypress" id="key_left" key="b" control="true"
command="cmd_charPrevious"/>
<handler type="keypress" id="key_right" key="f" control="true"
command="cmd_charNext"/>
<handler type="keypress" id="key_delback" key="h" control="true"
command="cmd_deleteCharBackward"/>
<handler type="keypress" id="key_delforw" key="d" control="true"
command="cmd_deleteCharForward"/>
<handler type="keypress" id="key_delwback" key="w" control="true"
command="cmd_deleteWordBackward"/>
<handler type="keypress" id="key_del_bol" key="u" control="true"
command="cmd_deleteToBeginningOfLine"/>
<handler type="keypress" id="key_del_eol" key="k" control="true"
command="cmd_deleteToEndOfLine"/>
<!-- Windows copy/paste/undo/redo keys -->
<handler type="keypress" id="key_wincopy" key="c" control="true"
command="cmd_copy"/>
<handler type="keypress" id="key_wincut" key="x" control="true"
command="cmd_cut"/>
<handler type="keypress" id="key_winundo" key="z" control="true"
command="cmd_undo"/>
<handler type="keypress" id="key_winredo" key="r" control="true"
command="cmd_redo"/>
</handlers>
</binding>
<binding name="textAreas" extends="resource:/chrome/htmlBindings.xml#textAreasBase">
<handlers>
<!-- Emacsish single-line motion and delete keys -->
<handler type="keypress" id="key_home" key="a" control="true"
command="cmd_beginLine"/>
<handler type="keypress" id="key_end" key="e" control="true"
command="cmd_endLine"/>
<handler type="keypress" id="key_left" key="b" control="true"
command="cmd_charPrevious"/>
<handler type="keypress" id="key_right" key="f" control="true"
command="cmd_charNext"/>
<handler type="keypress" id="key_delback" key="h" control="true"
command="cmd_deleteCharBackward"/>
<handler type="keypress" id="key_delforw" key="d" control="true"
command="cmd_deleteCharForward"/>
<handler type="keypress" id="key_delwback" key="w" control="true"
command="cmd_deleteWordBackward"/>
<handler type="keypress" id="key_del_bol" key="u" control="true"
command="cmd_deleteToBeginningOfLine"/>
<handler type="keypress" id="key_del_eol" key="k" control="true"
command="cmd_deleteToEndOfLine"/>
<!-- Windows copy/paste/undo/redo keys -->
<handler type="keypress" id="key_wincopy" key="c" control="true"
command="cmd_copy"/>
<handler type="keypress" id="key_wincut" key="x" control="true"
command="cmd_cut"/>
<handler type="keypress" id="key_winundo" key="z" control="true"
command="cmd_undo"/>
<handler type="keypress" id="key_winredo" key="r" control="true"
command="cmd_redo"/>
<!-- Emacsish multi-line motion and delete keys -->
<handler type="keypress" id="key_linedown" key="n" control="true"
command="cmd_lineNext"/>
<handler type="keypress" id="key_lineup" key="p" control="true"
command="cmd_linePrevious"/>
</handlers>
</binding>