Skip to content

Can't type the at sign (@) with Spanish keyboard layout #2235

Description

@pauginer

Description

When typing "@" in the editor, the "insert" dialog is shown. This works as expected when using the US keyboard layout. However, it is not possible to type "@" when using the Spanish keyboard layout. With the Spanish keyboard layout, I press alt+2 key combination which is expected to type the @ character, but the character is not added to the editing surface (and the insert menu is not shown).

The problem is not limited to the initial position of a paragraph. Trying to type @ in the middle of the paragraph is also ignored.

I used the 0.16.2 version for Mac.

  • Can you reproduce the issue

Steps to reproduce

  1. Change keyboard preferences on Mac to use "Spanish -ISO"
  2. Open Mark Text editor and press alt + 2.
  3. Observe that nothing is added to the document.
  4. Check the alt + 2 combination to verify that the @ simbol is added in other programs such as web browser or system text editors.

Expected behavior:
The @ character should be added to the document. In addition, the insert dialog should be shown when the character is added at the begning of an empty paragraph..

Actual behavior:

The @ sign is not added. You cannot type the @ sign in your contents or access the insert menu without switching the keyboard layout options first.

Versions

  • Mark Text version: 0.16.2
  • Operating system: Mac OS 10.14.6

Activity

  1. brainchild0 commented on Jun 24, 2020

    @brainchild0
    Contributor

    Possibly related to #2225.

  2. brainchild0 commented on Jun 25, 2020

    @brainchild0
    Contributor

    Unable to reproduce on Mint Cinnamon. Using Spanish (es) keyboard layout, AltR-2 produces @ character in editing buffer.

  3. brainchild0 commented on Jun 25, 2020

    @brainchild0
    Contributor

    Do other symbols work correctly for the same pattern, but with a number key different from 2?

  4. pauginer commented on Jun 26, 2020

    @pauginer
    Author

    Do other symbols work correctly for the same pattern, but with a number key different from 2?
    I tried different combinations:

    • Combinations of alt + number fail in the same way described above. For example "alt+3" produces "#" in other editors, but nothing in Mark Text. Another example: "alt"+ "6" produce "¬" in other editors but nothing on MarkText.
    • Combinations of "alt" with non-numeric keys work as expected. For example "alt" + "+" inserts the "]" character correctly. Another example: "alt" + "ç" inserts the "}" character correctly.
  5. pauginer commented on Jun 26, 2020

    @pauginer
    Author

    Possibly related to #2225.

    Thanks for sharing this. Based on the info of that issue, I tried the version 0.15.1, and the issue is not present in the old version. I can type @,#, etc. and the characters get added to the document without any issue (showing also the insert dialog when appropriate)

  6. brainchild0 commented on Jun 27, 2020

    @brainchild0
    Contributor

    It seems that Electron has problems with non-US keyboard layouts, affecting other popular applications such as Atom and VSCode.

    See electron/electron#17287, atom/atom#19168, and atom/atom#19968.

    The VSCode project has compiled a list of workarounds for various issues. Some solutions require creating a keybindings.json file, which is supported in Mark Text. If any solutions work, please share results.

    @Jocs @fxha: Is it feasible to consider reverting to a previous version of Electron? Also, Mark Text 16.0 introduces the spell checker, which depends on node package keyboard-layout. Might this dependency be causing problems in Mark Text? Based on reports for this and other Electron applications, this issue probably has very high impact on users of Mark Text.

    Suggest closing ##2225, in favor of this issue, assigning label for high priority, and renaming to reflect the broader scope of the problem.

  7. RasmusMalver commented on Jan 11, 2021

    @RasmusMalver
  8. brainchild0 commented on Jan 11, 2021

    @brainchild0
    Contributor

    @rasmis If this solution is robust and portable, then perhaps it should be integrated into the application distribution, until a more reliable solution is available, such as one from the downstream source.

    (Perhaps it would be advantageous, for convenience and clarity, to include the solution verbatim into your above comment, which now shows only a hyperlink.)

  9. Jaaaarne commented on May 23, 2021

    @Jaaaarne

    Is there a similar solution for Windows?

  10. brainchild0 commented on May 23, 2021

    @brainchild0
    Contributor

    @Jaaaarne: You might try some of the troubleshooting tips from the earlier references, and then report back. It seems no one yet has reported a direct solution in this discussion for Windows.

  11. fxha commented on Dec 16, 2021

    @fxha
    Contributor

    Problem description: Users are unable to use certain characters because we force map shortcuts like Alt+1 to switch to the first tab. The key combination is unavailable to Chromium after force mapping.

    Solution: I think the best solution would be to map tab switching to Ctrl+<num> and heading changes are performed via Ctrl+Shift+<num>. This would result in a consistent solution across all platforms.

    /cc @Jocs @csingewald


    Could someone with this issue please run marktext --dump-keyboard-layout and upload the result. I'm currently unsure why Alt+<num> is used for characters. Usually Ctrl+Alt (AltGr) should be used for this?

  12. added
    🐛 bug
    on Dec 16, 2021
  13. reopened this on Jan 2, 2022
  14. brainchild0 commented on Jan 2, 2022

    @brainchild0
    Contributor

    I'm confused about some of the recent activity.

    The understanding I resolved was that the issue came from problems in Chromium and Electron that appear on some non-US key mappings, particularly for entry of characters formed by sequential composition of key strokes. Such use of key combinations is different from concurrent combinations with control keys used for shortcuts. I have never been aware of a conflict in applications between sequential composition for character entry, provided by the key map, and concurrent use of control keys, provided as shortcuts by the application.

  15. fxha commented on Jan 2, 2022

    @fxha
    Contributor

    We had a few problems with application menu shortcuts on non-US keyboards that was resolved by patching the shortcuts at runtime. This is done by reading the keyboard information from the system and an internal mapping of know keys based on the keyboard language. Afterwards, we register the patched shortcuts via Electron/Chromium and prevent the default key event because the shortcut was triggered twice under some circumstances. E.g. on a US keyboard the shortcut was triggered by our handler and the second time by the application menu. Easiest solution was to set the shortcut as handled because we already consumed it, why would someone else handle this event afterwards? We got this idea from other Electron application with the same problem.

    Finally, here we have the problem that some keys, more precisely key combinations, stopped working after upgrading MarkText (e.g. Alt+2). Normally Alt+2 shouldn't output any character but you can configure the system to do so. To output a character Ctrl+Alt or AltRight is used by default, but if you register AltLeft (=Alt) in your system as stroke for alternative characters we're running into a big problem because we prevent the default behavior of registered shortcuts. Alt+2 is used as shortcut for switching tabs and prevent Electron/Chromium from handling the event. Instead of producing a character, the tab is switched. Your OS may handle this case for you, e.g. my system will send the corresponding character to Electron and not Alt+2 if I use AltLeft as stroke for alternative characters. Another may send Alt+2 and Chromium have to produce the character but never gets the chance for it because we prevent this. This depends on the keyboard handler of your OS or driver, I'm not a expert in this area.

    The proposed idea by different users was to revert Alt+<number> for tab switching to restore the old behavior (like before v0.16). Then, Chromium can receive and convert the key event into a character if needed. If this approach isn't successful, we need to refactor the shortcut handling. For now, I hope this will resolve the problem because I don't want to spend any more time on shortcuts 😄 .

  16. brainchild0 commented on Jan 2, 2022

    @brainchild0
    Contributor

    In general, of course, applications and systems support both composite key sequences for character entry and concurrent combinations for shortcuts. If there is a problem providing support for both, then the reason one would suspect is a flaw in a framework or system.

    Is what you are explaining that the problem results as a side effect from an earlier solution in MarkText, in which certain events would be processed directly by the application, before they reach the default handler provided by the system?

  17. brainchild0 commented on Jan 3, 2022

    @brainchild0
    Contributor

    The issue tracked for Electron, which I referenced earlier, has since been resolved. Would it be helpful to test against a snapshot of Electron upstream to the resolution, or do you think those revisions are not related to the current problem in MarkText?

  18. fxha commented on Jan 4, 2022

    @fxha
    Contributor

    @brainchild0 Thanks for your suggestion, but unfortunately the issue is still present and labelled as won't fix by Electron team. Alt + other should work in our next release and I'll provide a fix soon.

  19. self-assigned this
    on Jan 4, 2022
  20. brainchild0 commented on Jan 4, 2022

    @brainchild0
    Contributor

    @fxha: It seems I don't understand your view of the current problem, or your explanation of the history, but the symptoms appear to me to match the issue in Electron (and those in related projects) that I had referenced previously. The issue I referenced, in Electron, is reported as resolved, not marked "won't fix".

    Which issue is the one you reviewed labeled "won't fix"?

  21. fxha commented on Jan 5, 2022

    @fxha
    Contributor

    @brainchild0

    The issue I referenced, in Electron, is reported as resolved, not marked "won't fix".

    Electron#17287 was about a system shortcut on macOS where the system shorcut Cmd + Backtick doesn't worked in Electron.

    Which issue is the one you reviewed labeled "won't fix"?

    I don't know and I'm currently unable to find it but it was about the application menu in Electron. It was labelled as won't fix because the application menu isn't used in Chromium and the Electron team didn't want to fix it themselves. All big Electron apps like Atom and VSCode using the same workaround that we use but with more effort to fix dead key etc. Our solution works for all letters but otherwise you have to customize your the key bindings file.

  22. pauginer commented on Nov 11, 2022

    @pauginer
    Author

    I can confirm this works now as expected in my set-up using the latest version. Thanks!!

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

Metadata

Metadata

Assignees

Labels

🐛 bug🔭 area/editor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions