Uh oh!
There was an error while loading. Please reload this page.
Fix some indent problems - #250
Conversation
* Pressing the TAB key on an empty line no longer inserts an additional tab. * Fixed problem that occasionally added an additional space character when typing a tab. * Disable built-in "electric chars" feature and replace with a less heavy-handed version. The new version does the following: * Only runs when closing braces are typed: "]", "}", or ")" * Only runs if the line is all whitespace (except the closing brace) This should eliminate the majority of the odd and unpredictable auto-indent behaviors.
There was a problem hiding this comment.
CodeMirror does this:
varch=String.fromCharCode(e.charCode==null ? e.keyCode : e.charCode);I'm assuming this is to deal with browsers that handle keyCode/charCode differently. Should we do the same?
There was a problem hiding this comment.
Wow, I had no idea how much of a mess JavaScript keyboard handling was until I read this page:
http://unixpapa.com/js/key.html
Luckily, for us, using keypress and checking for ASCII characters is easy:
http://stackoverflow.com/questions/1444477/keycode-and-charcode
Code updated.
njx
commented
Feb 14, 2012
Done with first review. |
njx
commented
Feb 14, 2012
Just tested this and it isn't working for me. If I'm in a blank JS file and I type: functionfoo(){blah();then hit Return after |
njx
commented
Feb 14, 2012
It looks like the problem is the "smart" argument--if I remove it, it does the right thing. So it must not be the case that passing "smart" is the same as passing nothing. |
gruehle
commented
Feb 14, 2012
Passing 'smart' wasn't so smart after all... removed. |
@njx
This should eliminate the majority of the odd and unpredictable auto-indent behaviors.
This fixes issues #155 and #193.