tamzinblake / js3-mode

A chimeric fork of js2-mode and js-mode
GNU General Public License v3.0
181 stars 13 forks source link

Preventing splitting string after backslash. #80

Closed katyo closed 11 years ago

katyo commented 11 years ago

I fixed the behavior of splitting string. Now when we press Enter key, if we're after a backslash, creating new string will be prevented, so we obtain backslash-newline-separated (\ \n in c-style) string.

So, when we typed something like this: "some\str" … and hit RET after \ char, we obtain: "some\ str" … instead of default behavior: "some\"

Of course, my fix is safe. So, using backslashes for escaping is covered. Even you typed something like: "some\str" … and hit RET after second slash, you will have "some\"

tamzinblake commented 11 years ago

This is way too many commits for one pull request. Splitting it up into separate features, and turning on new features conditionally.

katyo commented 11 years ago

Oh, sorry. Now it can be done.

tamzinblake commented 11 years ago

Hangs emacs. Try:

var a = "foo \
"

If you hit enter after that last quote, emacs will hang. Looking into causes, fixes. Any thoughts?

Also, I'm not sure I like the default behavior of putting a backslash on the next line.

tamzinblake commented 11 years ago

Hmm... not your code. Regular js3-mode does that too. Going to have to look into that.

katyo commented 11 years ago

Maybe, more right behavior is putting backslash only when cursor was on backslash not after.