Summary: | Cannot type special characters in the terminal | ||
---|---|---|---|
Product: | [Applications] konsole | Reporter: | mpeter.68m0y |
Component: | keyboard | Assignee: | Konsole Developer <konsole-devel> |
Status: | REPORTED --- | ||
Severity: | normal | CC: | ninjalj |
Priority: | NOR | Keywords: | qt6 |
Version: | master | ||
Target Milestone: | --- | ||
Platform: | Microsoft Windows | ||
OS: | Microsoft Windows | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
mpeter.68m0y
2024-03-10 22:19:33 UTC
The AltGr+# and AltGr+@ are interpreted by bash's readline: (https://www.gnu.org/software/bash/manual/bash.html#index-insert_002dcomment-_0028M_002d_0023_0029) > insert-comment (M-#) > Without a numeric argument, the value of the comment-begin variable is inserted at the beginning of the current line. If a numeric > argument is supplied, this command acts as a toggle: if the characters at the beginning of the line do not match the value of comment- > begin, the value is inserted, otherwise the characters in comment-begin are deleted from the beginning of the line. In either case, the line > is accepted as if a newline had been typed. The default value of comment-begin causes this command to make the current line a shell > comment. If a numeric argument causes the comment character to be removed, the line will be executed by the shell. (https://www.gnu.org/software/bash/manual/bash.html#index-complete_002dhostname-_0028M_002d_0040_0029) > complete-hostname (M-@) > Attempt completion on the text before point, treating it as a hostname. (M is the Meta key from ancient Lisp keyboards, which in emacs and readline is usually emulated by using the Alt key on modern keyboards). You can disable the above with: bind -m emacs-meta -r '@' bind -m emacs-meta -r '#' (In reply to ninjalj from comment #1) > The AltGr+# and AltGr+@ are interpreted by bash's readline: > > (https://www.gnu.org/software/bash/manual/bash.html#index-insert_002dcomment- > _0028M_002d_0023_0029) > > insert-comment (M-#) > > Without a numeric argument, the value of the comment-begin variable is inserted at the beginning of the current line. If a numeric > > argument is supplied, this command acts as a toggle: if the characters at the beginning of the line do not match the value of comment- > > begin, the value is inserted, otherwise the characters in comment-begin are deleted from the beginning of the line. In either case, the line > > is accepted as if a newline had been typed. The default value of comment-begin causes this command to make the current line a shell > > comment. If a numeric argument causes the comment character to be removed, the line will be executed by the shell. > > (https://www.gnu.org/software/bash/manual/bash.html#index- > complete_002dhostname-_0028M_002d_0040_0029) > > complete-hostname (M-@) > > Attempt completion on the text before point, treating it as a hostname. > > (M is the Meta key from ancient Lisp keyboards, which in emacs and readline > is usually emulated by using the Alt key on modern keyboards). > > You can disable the above with: > > bind -m emacs-meta -r '@' > bind -m emacs-meta -r '#' Thank you for your help, this is good to know. I didn't think it is bash that could be doing that. The two commands did not fix the problem, though. After running the first one, @ still cant be typed, and after running the second one typing # does not comment the line anymore, but a # is not typed either. As I perceive currently nothing happens when attempting to type @ or #. Also, when we figure out the exact problems (in case there is more than what you have discovered already), would it be possible to integrate the solution into Konsole? Windows Terminal passes these inputs to bash by default in a way that doesnt confuse it, and it would be very helpful if Konsole too worked out of the box that way. Not sure how is it with other layouts, but among Hungarian keyboards its common to have the right Alt as an AltGr key. Ok, instead of the above commands, try: bind -m emacs-meta '"@": self-insert' bind -m emacs-meta '"#": self-insert' Can you try launching konsole with -platform windows:altgr? As per https://bugreports.qt.io/browse/QTBUG-69317 and https://bugreports.qt.io/browse/QTBUG-83032 this should allow to detect AltGr as different from Ctrl+Alt. After running the 2 commands, typing both the @ and the # characters work as expected! However if I start Konsole as `konsole.exe -platform windows:altgr`, the above characters work as expected even without running the bind commands! To test this I have restarted the WSL environment, it seems the effect of the `bind` commands are somehow persisted across Konsole processes. Now this really makes a difference! :) For now I have created a `qt.conf` file besides konsole.exe with the following content, so that Konsole always starts this way. ``` [Platforms] WindowsArguments = altgr ``` Unless theres a better solution, you could consider shipping such a file in the windows release, with the installer and portable archives. |