Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Backslash prevents pair autocompletion #80

Closed

Description

@SahilMadan-zz

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.

printf("Hello world\n ")

Animated GIF

Activity

  1. AlexanderGalen commented on Nov 6, 2014

    @AlexanderGalen

    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.

  2. self-assigned this
    on Nov 10, 2014
  3. joebentley commented on Jun 30, 2015

    @joebentley

    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

  4. 190n commented on Jul 15, 2015

    @190n

    +1

  5. removed their assignment
    on Aug 7, 2015
  6. novelistparty commented on Dec 3, 2015

    @novelistparty

    out

    I am bothered by this every day.
    Atom 1.2.4, OS X 10.11.1

  7. WalterGR commented on Dec 25, 2015

    @WalterGR

    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

    (str h)
    

    Typing (str \h) results in

    (str \h))
    
  8. zmbc commented on Mar 2, 2016

    @zmbc

    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.

  9. andyfriesen commented on Mar 2, 2016

    @andyfriesen
    Contributor

    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.

  10. zmbc commented on Mar 2, 2016

    @zmbc

    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.

  11. changed the title [-]Escape character incurs an extra quotation mark[/-] [+]Backslash prevents pair autocompletion[/+] on Sep 25, 2016
  12. mareklipka commented on Jan 17, 2017

    @mareklipka

    What's the status of this issue? I can confirm it still occurs in 1.13.0. Any progress on this?

  13. winstliu commented on Jan 17, 2017

    @winstliu
    Contributor

    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.

  14. muppetjones commented on Feb 19, 2017

    @muppetjones

    @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.

  15. WalterGR commented on Feb 19, 2017

    @WalterGR

    I agree.

    If the PR improves the situation, then it should be accepted.

  16. added a commit that references this issue on Feb 24, 2017
  17. winstliu commented on Feb 24, 2017

    @winstliu
    Contributor

    I've created an updated PR at #276 that fixes the remaining issues I was seeing with #201.

  18. winstliu commented on Feb 24, 2017

    @winstliu
    Contributor

    Should be fixed in Atom 1.16.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions