Braces and brackets behaviors in iOS vs. MacOS

enrico.scarpella's Avatar

enrico.scarpella

22 Oct, 2018 10:34 PM

Dear Fletcher,

I found two differences between the iOS version and the MacOS version:

1. Currently the style for braces can only be applied to {{foo}} in the MacOS version, but it can be applied -- as it should -- to {foo} in the iOS version. Perhaps the typo in the MacOS code has already been fixed in the iOS version?

2. When I type [ in both the MacOS version and the iOS version, I see [] (I have smart pairs selected); when I type a space between the brackets in the MacOS version, I obtain [ ], but in the iOS version, the second bracket (i.e. ]) disappears. I prefer the MacOS behavior: it allows me to quickly create check-boxes. Could the iOS behavior be fixed please?

Thank you for your consideration.

Best regards,
Enrico

  1. Support Staff 1 Posted by Fletcher on 23 Oct, 2018 12:02 AM

    Fletcher's Avatar
    1. Currently the style for braces can only be applied to {{foo}} in the MacOS version, but it can be applied -- as it should -- to {foo} in the iOS version. Perhaps the typo in the MacOS code has already been fixed in the iOS version?

    Correct -- they use the same code base (with a few lines of code that are platform specific due to differences in Apple's API), so whichever version is "younger" will contain fixes that might not be in the other platform yet.

    1. When I type [ in both the MacOS version and the iOS version, I see ; when I type a space between the brackets in the MacOS version, I obtain [ ], but in the iOS version, the second bracket (i.e. ]) disappears. I prefer the MacOS behavior: it allows me to quickly create check-boxes. Could the iOS behavior be fixed please?

    I'll look into it. Thanks for pointing this out!

    Fletcher

  2. 2 Posted by enrico.scarpell... on 23 Oct, 2018 12:20 AM

    enrico.scarpella's Avatar

    Thank you very much for the prompt response, Fletcher.

    Best regards,
    Enrico

  3. Support Staff 3 Posted by Fletcher on 06 Nov, 2018 07:50 PM

    Fletcher's Avatar

    Digging into this further, the problem is actually in the macOS version (and possibly also in iOS).

    Typing a smart pair character, and then typing a whitespace character immediately afterwards, is supposed to replace the smart pair closing character.

    This happens most often when typing quotes -- it is exceptionally rare that one wants to type a pair of characters and then have the first character be a whitespace character. Usually when doing that, you actually mean to only type the initial character of the pair.

    The one exception may be what you stumbled into -- typing a "check box" consisting of [ ].

    On macOS, when I type test[ and then space, I get test[.

    On macOS, when I type test [ and then space, I get test [ ]

    On iOS, in both cases the ] character is deleted.

    I need to track down what is going on in macOS to fix it.

    That said, this will not help your particular situation, as it will replicate the iOS behavior on macOS. However, you still need the same number of keystrokes -- in the "old" way, you type ] to move the cursor beyond the brackets so you can continue typing. In the "new" way, you type ] to reinsert the closing bracket and move beyond it.

    Regardless, the behavior should be consistent.

    Fletcher

  4. Support Staff 4 Posted by Fletcher on 06 Nov, 2018 08:02 PM

    Fletcher's Avatar

    I figured out the distinction -- if you have "Autocomplete labels" enabled, then Composer inserts an invisible action that replaces the contents of the empty label ([]) with an empty string (``). This has no effect on the visible text, but inserts a step between typing the smart pair and typing the space key, which disables the "type space to overwrite closer" behavior.

    Technically, I suppose this is a bug, and I could modify the behavior to skip the replacement if there is an empty string. But, there is really no harm here, and it provides a benefit to people in your situation (wanting to type [ ] to indicate a check box).

    For now, I will leave this alone in macOS. I may or may not implement an autocompletion function on iOS -- it needs to be consistent with standard iOS behavior if I do. If that happens, then you would gain the same protection on iOS. But otherwise, the behavior on iOS is actually correct.

    Fletcher

  5. 5 Posted by enrico.scarpell... on 06 Nov, 2018 10:55 PM

    enrico.scarpella's Avatar

    Thank you very much for looking into that, Fletcher.

    You're right, the "bug" is in the MacOS version: of all the smart pairs I've tried, the square bracket is the only one that behaves that way; it is convenient for checkboxes, but I understand it may not be implemented in the iOS version. Thank you very much again.

    Best regards,
    Enrico

  6. Fletcher closed this discussion on 30 Nov, 2018 03:01 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac