-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Conversation
Two quick thoughts:
|
Oh, IIRC another bug was that typing ":" inside a comment would cause the indentation to jump also... |
Well, #8395 is still fixed as I left the code in (see diff) :) |
Oh I see -- didn't realize you found a way to keep that. Looks like that code needs to be made multi-cursor-aware though, otherwise #8434 isn't really fully fixed. |
I just did some further tests and couldn't find any issues with ":", at least in JS mode. |
83c5d74
to
5423209
Compare
@peterflynn FYI, I fixed the anti-orphan code to support multiple cursors. |
Cool, thanks for making that update! I don't have a lot of cycles next week to do any testing, but hopefully someone else on the team can pick this up sooner. |
@marcelgerber Hey Marcel, we are locking down for 1.0 but it will go into the next release. |
@marcelgerber Picking this for review. |
/** | ||
* @private | ||
* Handle CodeMirror key events. | ||
* @param {!Event} event | ||
*/ | ||
Editor.prototype._handleKeypressEvents = function (event) { | ||
this._checkElectricChars(event); | ||
var keyStr = String.fromCharCode(event.which || event.keyCode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcelgerber Hii.. Can you please write this in separate function as it is specific to electricChars handling.
@prafulVaishnav Done. Please let me know when you'd like to merge so I can squash commits. |
@marcelgerber You can squash commit. I will merge it then. |
7bb54bf
to
b341de5
Compare
@prafulVaishnav Ready. |
b341de5
to
6449fdf
Compare
var keyStr = String.fromCharCode(event.which || event.keyCode); | ||
|
||
if (/[\]\{\}\)]/.test(keyStr)) { | ||
this._removeWhitespaceAfterBrace(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcelgerber Please update the function name to _handleWhitespaceForElectricChars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Fixed.
6449fdf
to
531c8d0
Compare
@marcelgerber Thanks.. It must fix various issues. I will check and close them all. |
In the description above, I listed some issues that should be fixed now. |
I also filed codemirror/codemirror5#3188, suggesting an event on electric char indent, so we can call |
@marcelgerber Thanks.. We will track it and once it is there we will make the change. |
This fixes multiple issues:
#1324, #8434, #8723, #8980, #9120
I verified #8395 (fixed by #8439) is still fixed.
There's one behaviour change (tracked via codemirror/codemirror5#2812):
In a switch statement (JS), the cursor automatically indents 2 units, but back-indents as soon as you type "case".
@peterflynn You once noted (on IRC) you saw flaws with CM's implementation, could you please take a look?
cc @JeffryBooher