Fix backspace to go back and forward on win32 (bug 207175). Patch (mostly) by noririty@jcom.home.ne.jp.

This commit is contained in:
bryner%netscape.com 2003-05-31 18:43:50 +00:00
Родитель fada4df823
Коммит c474a4fae7
2 изменённых файлов: 31 добавлений и 1 удалений

Просмотреть файл

@ -591,6 +591,29 @@ function BrowserBack()
}
}
#ifdef XP_WIN
function BrowserHandleBackspace()
{
// The order of seeing keystrokes is this:
// 1) Chrome, 2) Typeahead, 3) [platform]HTMLBindings.xml
// Rather than have typeaheadfind responsible for making VK_BACK
// go back in history, we handle backspace it here as follows:
// When backspace is pressed, it might mean back
// in typeaheadfind if that's active, or it might mean back in history
var typeAhead = null;
const TYPE_AHEAD_FIND_CONTRACTID = "@mozilla.org/typeaheadfind;1";
if (TYPE_AHEAD_FIND_CONTRACTID in Components.classes) {
typeAhead = Components.classes[TYPE_AHEAD_FIND_CONTRACTID]
.getService(Components.interfaces.nsITypeAheadFind);
}
if (!typeAhead || !typeAhead.backOneChar()) {
BrowserBack();
}
}
#endif
function BrowserForward()
{
try {

Просмотреть файл

@ -103,6 +103,10 @@
<command id="cmd_bm_paste" oncommand="goDoCommand('cmd_bm_paste');"/>
<command id="cmd_bm_delete" oncommand="goDoCommand('cmd_bm_delete');"/>
#ifdef XP_WIN
<command id="cmd_handleBackspace" oncommand="BrowserHandleBackspace();" />
#endif
<command id="cmd_newNavigatorTab" oncommand="BrowserOpenTab();"/>
<command id="Browser:OpenFile" oncommand="BrowserOpenFileWindow();"/>
<command id="Browser:SavePage" oncommand="saveDocument(window._content.document);"/>
@ -216,7 +220,10 @@
<key id="key_selectAll" key="&selectAllCmd.key;" modifiers="accel"/>
<key id="goBackKb" keycode="VK_LEFT" command="Browser:Back" modifiers="alt"/>
<key id="goForwardKb" keycode="VK_RIGHT" command="Browser:Forward" modifiers="alt"/>
#ifdef XP_WIN
<key keycode="VK_BACK" command="cmd_handleBackspace"/>
<key keycode="VK_BACK" command="Browser:Forward" modifiers="shift"/>
#endif
<key keycode="VK_F5" oncommand="BrowserReload();"/>
<key keycode="VK_F5" modifiers="control" oncommand="BrowserReloadSkipCache();"/>