Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Surrounding multiple words with ` characters is broken #6940

Closed

Description

@nshtg

I'm not sure which package is responsible so I'm reporting the issue here. Tested with 0.202.0-ec5b807 in --safe mode.

When you select multiple words and surround them with " or ' signs everything works perfectly. However, when I try to do the same with -signs something weird happens (gif is easiest to show). First the words disappear, then I press Space and they reappear - wrapped - but the words are wrong. Note that Cmd-Z removes the -signs but can not restore the original words.

atombug

Activity

  1. izuzak commented on May 25, 2015

    @izuzak
    Contributor

    I'm not able to reproduce this with Atom 0.202.0-4bbfe37 in safe mode:

    quotes

    Anything in your init.coffee file or other local config files? Can you reproduce this if you move the .atom folder somewhere else (and restart Atom after that)? Which OS are you on (not sure how that would make a difference, but worth asking for completeness)?

  2. nshtg commented on May 25, 2015

    @nshtg
    Author

    Rebuild atom to 0.202.0-4bbfe37, removed the ~/.atom folder and tried again in atom --safe mode. Problem persists. I'm pretty sure it has to do with the OS, im on OSX 10.10.3.

    You can produce letters like á é ú by pressing and then a/e/u. OSX waits on the following character to see if it should be replaced. If I press space gets inserted, if I press a/e/u it inserts àèù:

    atombug3

    As soon as I press Space atom expands the one ` sign to ``. Not that much we can change about that (OS behaviour), but why is atom replacing the first word?

    OS Locale is English, Keyboard layout is German (QWERTZ). (Edit: Problem persists with US-layout)

  3. izuzak commented on May 25, 2015

    @izuzak
    Contributor

    I'm pretty sure it has to do with the OS, im on OSX.

    I'm on OSX as well.

    You can produce letters like á é ú by pressing ` and then a/e/u. OSX waits on the following character to see if it should be replaced.

    Not on my machine:

    quotes2

    Which keyboard layout are you using? Not US, I'm guessing?

  4. nshtg commented on May 25, 2015

    @nshtg
    Author

    No I have a german keyboard layout. Switching to US makes it behave like on your machine now and the surrounding works.

    Question remains, why is atom replacing the first word? I would understand if it would delete both words but instead it does this weird thing. + Undoing will not restore the original state, which is weird.

  5. izuzak commented on May 25, 2015

    @izuzak
    Contributor

    Question remains, why is atom replacing the first word?

    I'm not sure, but I'm trying to figure out one thing at a time. I think that's easier and less complicated than discussing 2 different issues at the same time.

    I'd say that surrounding words with backticks isn't broken, it's more how the OS is handling those backtickts. If you select two words, as you did in the GIF, then press the backtick, and then press escape, what do you see then (with the german layout)? Can you record a GIF of that with the keybinding resolver shown?

  6. nshtg commented on May 25, 2015

    @nshtg
    Author

    atombug4

  7. izuzak commented on May 25, 2015

    @izuzak
    Contributor

    Thanks -- that looks broken to me as well (pressing escape seems to do the same thing as pressing space, which is what you were doing originally, but just wanted to confirm).

    /cc @nathansobo for 👀 -- any chance this is an easy fix ™️ ? 😄

  8. nathansobo commented on May 26, 2015

    @nathansobo
    Contributor

    This seems to be related to our general issues with international keyboard support due to bugs in Chrome. The keybinding resolver seems to identify the keystroke as Å when I enter a backtick via the German layout. Can you guys confirm the same behavior. We already have a bunch of known issues on international layouts so add this to the list.

  9. nshtg commented on May 26, 2015

    @nshtg
    Author

    I can confirm that behaviour, you can see it in my latest gif too.

    However, question remains, why does it replace the first word? I would totally understand if the wrapping failed or nothing happend at all, but the behaviour seems really odd. Why does it wrap the word at all if the keyboard layout is the main problem?

  10. slhck commented on Jul 17, 2015

    @slhck

    Still got the problem on 1.0.2 on OS X, using a German (QWERTZ) keyboard layout.

    When I select multiple lines, then try to wrap them in backticks, confirm the (dead) backtick key with a space, it replaces all words with the first one, and, of course, there's no way to undo that either.

  11. jeancroy commented on Jul 23, 2015

    @jeancroy
    Contributor

    Some idea: I believe the key point is when all text disappear.

    When someone type " ` " :

    • you get GRAVE ACCENT \u0060 on keyboard that allow you to type directly.
    • but COMBINING GRAVE ACCENT \u0300 on keyboard that need two step to write.
      • ( or MODIFIER LETTER GRAVE ACCENT \u02CB )

    COMBINING + a = à
    COMBINING + SPACE = GRAVE ACCENT
    COMBINING + ESC = GRAVE ACCENT


    Looking at the @slhck screenshot here are the events I see

    • select all element, line per line.
    • type \u0300 - all text disappear leaving multiple `
    • type space - all text re-appear surrounded by \u0060 but have wrong value.

    Hypothesis: the issue exist because on some os/local we get the input in a two step process.

    1. Atom get incomplete input containing only COMBINING CHAR \u0300 (or \u02CB)
    2. Atom get another input asking to replace by COMBINED char \u0060

    hint? : the fact that, in animated screenshot, all selection got replaced.
    And that, before finishing the two-step entry of GRAVE ACCENT `


    Hypothetical stack trace:

    User input \u0300

    editor default behavior: overwrite

    • same editor behavior as if we have typed the letter "a" or any non bracket.

    User input "space"

    OS filter: backward replace COMBINING+ SPACE into GRAVE ACCENT `

    Enter insertText
    Enter wrapSelectionInBrackets
    True isOpeningBracket L156
    selection.getBufferRange() L167 - for some reason this return value of last selected item before overwrite.
    The way OS filter do the backward replacement probably skipped a buffer clean-up mechanism.

    We now have this item everywhere:

    `lastItem`
    

    If hypothesis is true, something like this could fix it:

    Index: lib/bracket-matcher.coffee
    <+>UTF-8
    ===================================================================
    --- lib/bracket-matcher.coffee  (date 1437610610000)
    +++ lib/bracket-matcher.coffee  (revision )
    @@ -151,6 +151,8 @@
           return false unless @isCursorOnInterpolatedString()
           bracket = '#{'
           pair = '}'
    +    else if bracket is '\u0300' or bracket is '\u02CB'
    +      return true
         else
           return false unless @isOpeningBracket(bracket)
           pair = @pairedCharacters[bracket]
    

    The idea would be to trigger this cancel event (so we do nothing with the modifier/combining char) and wait for the OS filter to give us proper char accent `

  12. jeancroy commented on Sep 5, 2015

    @jeancroy
    Contributor

    Issue #8667 has been closed but add the important point that this current issue is not limited to the back-tick. This could occurs with any character that is both an accent and a bracket. ```, ', and possibly one day something like `^` and `~`

    The range of character interesting to this issue could be
    Spacing Modifier Letters (02B0-02FF)
    Combining Diacritical Marks (0300–036F)

  13. stale commented on Aug 29, 2017

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  14. lock commented on Mar 30, 2018

    @lock

    This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

  15. locked and limited conversation to collaborators on Mar 30, 2018
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