codemirror / CodeMirror-v1

An editable-iframe based code editor in JavaScript. See https://github.com/marijnh/CodeMirror for the currently maintained version
http://codemirror.net/
Other
362 stars 63 forks source link

TypeError on tab #26

Closed tino closed 13 years ago

tino commented 13 years ago

Hi,

I am trying to use tab with the default config in Chrome 7.0.517.44. Wether I have selected text or not, the error I get is:

Uncaught TypeError: Property 'indentation' of object #<an HTMLBRElement> is not a function editor.js:958 Editor.indentLineAftereditor.js:958 Editor.indentAtCursoreditor.js:1210 Editor.reindentSelectioneditor.js:738 Editor.handleTabeditor.js:1023 Editor.keyDowneditor.js:803 (anonymous function)util.js:5 wrapHandlerutil.js:98

Using tabMode = 'spaces this error dissappears.

tino commented 13 years ago

This is on a Mac btw. The error also occurs in Safari

marijnh commented 13 years ago

Which parser are you using? Sounds like it's not providing indentation info.

tino commented 13 years ago

Ah, that is the problem. I was using the rst parser from https://gist.github.com/497582#file_parserst.js. It was indeed missing an indentation function. I added a very basic one, so it is working now.

Thanks for the quick reply.

Tino

marijnh commented 13 years ago

It's actually kind of stupid that CodeMirror breaks in this case. I've pushed a patch that just sets indentation to 0 when the parser doesn't provide indentation.