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 }}
Repository navigation
Can't type the at sign (@) with Spanish keyboard layout #2235
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
Change keyboard preferences on Mac to use "Spanish -ISO"
Open Mark Text editor and press alt + 2.
Observe that nothing is added to the document.
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.
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.
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)
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.
@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.)
@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.
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.
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?
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.
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 😄 .
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?
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?
@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.
@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"?
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.
Activity
brainchild0 commentedon Jun 24, 2020
Possibly related to #2225.
brainchild0 commentedon Jun 25, 2020
Unable to reproduce on Mint Cinnamon. Using Spanish (
es) keyboard layout, AltR-2 produces@character in editing buffer.brainchild0 commentedon Jun 25, 2020
Do other symbols work correctly for the same pattern, but with a number key different from 2?
pauginer commentedon Jun 26, 2020
pauginer commentedon Jun 26, 2020
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)
brainchild0 commentedon Jun 27, 2020
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.jsonfile, 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.
RasmusMalver commentedon Jan 11, 2021
Temporary solution.
brainchild0 commentedon Jan 11, 2021
@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.)
Jaaaarne commentedon May 23, 2021
Is there a similar solution for Windows?
brainchild0 commentedon May 23, 2021
@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.
fxha commentedon Dec 16, 2021
Problem description: Users are unable to use certain characters because we force map shortcuts like
Alt+1to 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 viaCtrl+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-layoutand upload the result. I'm currently unsure whyAlt+<num>is used for characters. UsuallyCtrl+Alt(AltGr) should be used for this?brainchild0 commentedon Jan 2, 2022
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.
fxha commentedon Jan 2, 2022
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). NormallyAlt+2shouldn't output any character but you can configure the system to do so. To output a characterCtrl+AltorAltRightis used by default, but if you registerAltLeft(=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+2is 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 notAlt+2if I useAltLeftas stroke for alternative characters. Another may sendAlt+2and 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 😄 .brainchild0 commentedon Jan 2, 2022
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?
brainchild0 commentedon Jan 3, 2022
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?
fxha commentedon Jan 4, 2022
@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.brainchild0 commentedon Jan 4, 2022
@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"?
fxha commentedon Jan 5, 2022
@brainchild0
Electron#17287 was about a system shortcut on macOS where the system shorcut
Cmd + Backtickdoesn't worked in Electron.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.
pauginer commentedon Nov 11, 2022
I can confirm this works now as expected in my set-up using the latest version. Thanks!!