Open Bug 984089 Opened 11 years ago Updated 3 years ago

Remove the overridden TAB keymap in editor.js

Categories

(DevTools :: Source Editor, defect)

defect

Tracking

(Not tracked)

People

(Reporter: Optimizer, Unassigned)

Details

As far as I can see CodeMirror by default has exactly the same behavior as what is being tried to achieve in editor.js's constructor of Editor class. We should not override it as it makes it impossible for Firefox Add-ons to override the Tab key via the extraKeys route.
If you go to http://codemirror.net/ and pres [tab] in the text editor, a hard-tab will be inserted instead of two spaces. Hence why we do it in the editor.js
So the right way is to add an extra key, instead of overriding the tab key completely. And then using the insertSoftTab command of CM rather than replacing tabs with space and stuff. I will attach a patch.
That code was taken from the manual: http://codemirror.net/doc/manual.html#keymaps
What we should do, instead, is check whether extraKeys has something to override the [tab] and then **append** to our current logic.
Product: Firefox → DevTools
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.