Closed Bug 951975 Opened 12 years ago Closed 12 years ago

devtools/sourceeditor/editor should let me reconfigure CodeMirror to change line wrapping

Categories

(DevTools :: Source Editor, defect, P3)

x86_64
Linux
defect

Tracking

(Not tracked)

VERIFIED FIXED
Firefox 29

People

(Reporter: jason.barnabe, Assigned: anton)

Details

Attachments

(1 file)

I'm attempting to implement CodeMirror in my extension Stylish. I would like to allow users to choose whether to wrap lines and have that choice reflected immediately. CodeMirror has a setOption method[1] that lets you change its configuration on the fly, including lineWrapping[2]. The JS implemented in devtools/sourceeditor/editor[3] hides the "cm" object from me so I can't access it to call this method. Oddly, it only lets me change the "mode" of CodeMirror[4]. I would like to have a setLineWrapping method, or more generally, a setOption method to be able to reconfigure CodeMirror on the fly. 1: http://codemirror.net/doc/manual.html#setOption 2: http://codemirror.net/doc/manual.html#option_lineWrapping 3: http://mxr.mozilla.org/mozilla-central/source/browser/devtools/sourceeditor/editor.js 4: http://mxr.mozilla.org/mozilla-central/source/browser/devtools/sourceeditor/editor.js#291
Since we already allow people to pass CodeMirror configuration I don't mind exposing setOption method *but* it has to reflect all the custom stuff we do in the constructor. In fact, constructor should probably use setOption.
Priority: -- → P3
Assignee: nobody → anton
Attached patch WIP 1Splinter Review
Actually, when I started doing this I realized that we don't do anything custom to CodeMirror options so this patch came to be super simple.
Attachment #8356298 - Flags: review?(mihai.sucan)
Attachment #8356298 - Flags: review?(mihai.sucan) → review+
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 29
Status: RESOLVED → VERIFIED
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: