You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Firstly, apologies for not being able to make a gif of the issue!
For hello_world.c, if I type the following:
printf("
A secondary (closing) quotation mark is automatically inserted (along with a closing bracket). I.e.
printf("") // The ") appear automatically
. If I type the following...
printf("Hello World");
As I type the closing quotation mark and bracket, the ones inserted automatically by Atom are replaced as I type over them.
However, if I type the following...
printf("Hello World\n"
The secondary quotation mark is not replaced or typed over. Instead, another quotation mark is inserted. This results in the following...
printf("Hello World\n"")
The expected behaviour (as also seen in Sublime Text) would be to behave consistently, and replace the automatically inserted closing quotation mark as I type over it.
The use of a escape character right before the closing quotation mark causes this problem to occur. I was able to cause this to occur with \t, \n, and \b. If I type a space between the escape character and the closing quotation mark, the error does not occur. I.e.
I just encountered this problem as well and I have an idea as to why this happens if it could be of any use to whomever would fix it.
My guess is that when you type the backslash, the bracket-matcher interprets the closing quote as a part of the escape sequence, but it doesn't go back to interpreting it as a regular quote after typing the escape character ("n" in your case), and so it doesn't replace it when you type the closing quote. I guess adding the space before closing the quote manages to reset how the bracket-matcher interprets the quote, no longer considering it part of the escape sequence.
Just an FYI, the general problem - backslashes preventing the automatic 'eating' of closing punctuation when typed manually - applies to all closing punctuation, not just single and double quotes.
In Clojure, for example, typing (str h) results in
To generalize, this occurs whenever you've only typed one character after a backslash, and behaves the exact same way with ( as with ".
Typing (\zz) or any other two character string after the backslash will not cause this error. It only occurs when the attempted closing " or ) is one of the two characters immediately after a backslash.
@50Wliu If the only issue is the odd number of backslashes, I'd say merge it. I can't speak for everyone, but I use backslashes between parentheses and quotes pretty often. Multiple backslashes? On occasion. The package is completely unusable now, but that fix would at least make it better.
Activity
AlexanderGalen commentedon Nov 6, 2014
I just encountered this problem as well and I have an idea as to why this happens if it could be of any use to whomever would fix it.
My guess is that when you type the backslash, the bracket-matcher interprets the closing quote as a part of the escape sequence, but it doesn't go back to interpreting it as a regular quote after typing the escape character ("n" in your case), and so it doesn't replace it when you type the closing quote. I guess adding the space before closing the quote manages to reset how the bracket-matcher interprets the quote, no longer considering it part of the escape sequence.
joebentley commentedon Jun 30, 2015
This behaviour is really annoying, has any progress been made on this? I can imagine that a tonne of people would be affected by it
190n commentedon Jul 15, 2015
+1
novelistparty commentedon Dec 3, 2015
I am bothered by this every day.
Atom 1.2.4, OS X 10.11.1
Fix atom#80
Fix atom#80
Fix atom#80
Fix atom#80
WalterGR commentedon Dec 25, 2015
Just an FYI, the general problem - backslashes preventing the automatic 'eating' of closing punctuation when typed manually - applies to all closing punctuation, not just single and double quotes.
In Clojure, for example, typing
(str h)results inTyping
(str \h)results inzmbc commentedon Mar 2, 2016
To generalize, this occurs whenever you've only typed one character after a backslash, and behaves the exact same way with
(as with".Typing
(\zz)or any other two character string after the backslash will not cause this error. It only occurs when the attempted closing"or)is one of the two characters immediately after a backslash.andyfriesen commentedon Mar 2, 2016
I have a fix for this at #201 which I think solves for both terminating quotes and parentheses.
Until it gets merged, you can try it out by cloning the package into your ~/.atom/packages directory.
zmbc commentedon Mar 2, 2016
Thanks! That fixes it. Hope it gets merged soon, this is a major annoyance that everyone shouldn't have to look around on Github in order to fix.
[-]Escape character incurs an extra quotation mark[/-][+]Backslash prevents pair autocompletion[/+]mareklipka commentedon Jan 17, 2017
What's the status of this issue? I can confirm it still occurs in 1.13.0. Any progress on this?
winstliu commentedon Jan 17, 2017
There is a PR, #201, that aims at fixing this, but there are some issues with that PR that need to be addressed before it can be merged.
muppetjones commentedon Feb 19, 2017
@50Wliu If the only issue is the odd number of backslashes, I'd say merge it. I can't speak for everyone, but I use backslashes between parentheses and quotes pretty often. Multiple backslashes? On occasion. The package is completely unusable now, but that fix would at least make it better.
WalterGR commentedon Feb 19, 2017
I agree.
If the PR improves the situation, then it should be accepted.
Fix #80
winstliu commentedon Feb 24, 2017
I've created an updated PR at #276 that fixes the remaining issues I was seeing with #201.
winstliu commentedon Feb 24, 2017
Should be fixed in Atom 1.16.0.