Today I set out to assign a shortcut key (or keyboard binding) to the rewrap function in Mail. I use Netscape 7.1. From pine I was used to use ctrl-j to rewrap long lines somewhat intelligently and rewrap in Mail provides the same functionality. It is only really useful when available in a shortcut since it is a editing command used while typing and formatting.
My first assumption that there may be prefs for each keyboard binding. Wrong. After some googling I found on mozilla.org a page which explains. Now, I cannot find the link. The page mentions
htmlBindings.xml
platformHTMLBindings.xml
in res/builtin and shows a way to add custom shortcuts in a separate file whose name must then be registered somewhere else. One also has to find which element or widget it is to which the command is applied. DOM inspector came to the rescue and showed the mail compose window has an "editor" element. The shortcut keys for the editor element are assigned in the editor section in platformHTMLBindings.xml. DOM inspector also showed the function name to be assigned to the keyboad shortcut for rewrapping is "cmd_rewrap". I had found out by searching the source code on mozilla.org before and this was good live confirmation. I decided to edit platformHTMLBindings.xml directly and just added this line
<handler event="keypress" key="j" modifiers="control" command="cmd_rewrap"/>
to the editor section in the file. After restarting, it worked somewhat to my surprise. In Mail I can now rewrap by typing ctrl-j(ustify).
Of course, there should be a much easier way to customize shortcuts.
Andreas
custom keyboard shortcuts, bindings
- aplesch
- Posts: 8
- Joined: July 3rd, 2003, 9:51 pm
or how to assign ctrl-j to rewrap
subject line as reference
- raj_bhaskar
- Posts: 1943
- Joined: November 7th, 2002, 3:50 am
- Location: Glasgow, Scotland
- Contact:
See also bug 57805
- aplesch
- Posts: 8
- Joined: July 3rd, 2003, 9:51 pm
-
- Posts: 2
- Joined: May 18th, 2003, 10:10 pm
I tried the keybinding instructions, with no success. I ended up having to hack navigatorOverlay.xul inside comm.jar, just to get the keybindings of Navigator 7 (ctrl-O for the open-URL dialog instead of open-file). MSIE still opens this window (on both ctrl-L and ctrl-O), so why make it so hard for someone who used Netscape 7.x or MSIE? Sorry, I know that's an old holy war.
I can live with tweaking stuff to fix Mozilla keybindings, and fortunately there are others hoping for a GUI tool to do it. But Phoenix/Firebird does not even have that dialog at all! I thought, OK, another setback, so I'll just bind ctrl-F to open-file and add ctrl-O to focus-URL-bar. Just my luck, there's a bug so the keybinding XUL doesn't work in Firebird. Another bug for me to vote for, and I'll keep using Mozilla until they fix it. But please, bring back the dialog for heaven's sake! Netscape 7.x, Mozilla 1.x, MSIE, and even Opera all have it, so there's no excuse for getting rid of the thing, especially if Firebird is slated to become the only Mozilla Browser and compete in the browser world.
I can live with tweaking stuff to fix Mozilla keybindings, and fortunately there are others hoping for a GUI tool to do it. But Phoenix/Firebird does not even have that dialog at all! I thought, OK, another setback, so I'll just bind ctrl-F to open-file and add ctrl-O to focus-URL-bar. Just my luck, there's a bug so the keybinding XUL doesn't work in Firebird. Another bug for me to vote for, and I'll keep using Mozilla until they fix it. But please, bring back the dialog for heaven's sake! Netscape 7.x, Mozilla 1.x, MSIE, and even Opera all have it, so there's no excuse for getting rid of the thing, especially if Firebird is slated to become the only Mozilla Browser and compete in the browser world.