[Mac] Emacs shortcuts parity: Ctrl-t should switch adjacent characters
Categories
(Core :: Widget: Cocoa, defect, P3)
Tracking
()
People
(Reporter: nfagerlund, Unassigned)
References
Details
Comment 1•17 years ago
|
||
| Reporter | ||
Comment 2•17 years ago
|
||
Updated•17 years ago
|
Comment 6•8 years ago
|
||
Updated•8 years ago
|
Comment 8•8 years ago
|
||
Comment 10•5 years ago
|
||
Hi, I'm a new contributor and I'm interested in working on this bug. In https://riot.im/app/#/room/#introduction:mozilla.org, @emilio messaged me saying that the shortcut might be best added alongside undo and redo here: https://searchfox.org/mozilla-central/rev/a4d62e09a4c46aef918667fa759bf9ae898dc258/dom/events/unix/ShortcutKeyDefinitions.cpp#9
It doesn't seem useful to support document.execCommand with this, so it would be added as a "no exec" command here: https://searchfox.org/mozilla-central/rev/a4d62e09a4c46aef918667fa759bf9ae898dc258/widget/CommandList.h#72. I think TransposeCharactersOperation could be a good name.
For input and textarea, that could be all that is necessary. In addition, it would be good to support:
- html contenteditable, and
- native Firefox UI elements such as the address bar and the bookmarks menu.
I'm a newbie to this project; any tips on how to approach this bug would be greatly appreciated!
Comment 11•5 years ago
|
||
I guess:
- Define new command for it as you said in
widget/CommandList.h. - Map native cocoa command to our internal command in
widget/cocoa/NativeKeyBindings.mm, although I don't know which command is what the command reported to this bug. - Then, the command will be set to
WidgetKeyboardEvent's command list automatically. - Then, it'll be call XUL command automatically by
keypressevent handler for editor. - Declare command class and register it.
- Then, make it calls new public method of
EditorBasefrom the command class. - The new public method should be similar to
EditorBase::InsertTextAsAction(), and perhaps, callsDeleteSelectionAsSubAction()andInsertTextAsSubAction()after creatingAutoPlaceholderBatchto make it undo-able once.
However, I'm not sure how to compute the range for the "character". In HTMLEditor, you need to ignore invisible whitespaces with WSRunScanner. And you need to take care of surrogate-pair, IVS, etc for avoiding splitting them. So, it may be not easy work...
Comment 12•5 years ago
|
||
For plaintext editor it should be sorta straight forward shouldnt it?
Comment 13•5 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #12)
For plaintext editor it should be sorta straight forward shouldnt it?
Yes, it is. But there are a lot of contenteditable editor which looks simple text editor, for example, Google Spreadsheet's input box and Twitter's input box. I think that not supporting it in HTMLEditor makes users confused.
Updated•3 years ago
|
Description
•