Abnormal trailing ^ on input

8 vues (au cours des 30 derniers jours)
Jose M Soler
Jose M Soler le 26 Sep 2024
I have suddenly run into a strange problem. Now, when pressing ^, my command line (not the editor) enters an abnormal state, writing ^ (underscored) AFTER the last of any subsequent input characters. The trailing ^ only disappears after pressing Enter (without its usual effect). The problem prevails after exiting and reopening matlab, and even after restarting the computer. Any solution or hint?
  4 commentaires
Stephen23
Stephen23 le 26 Sep 2024
Many keyboard layouts use a dead key for the caret: https://kbdlayout.info/features/deadkeys
Are you using one of those?
José María
José María le 26 Sep 2024
Déplacé(e) : Voss le 26 Sep 2024
Thaks for all the comments.
Yes, I am using Ubuntu 24.04 and a Spanish keyboard with dead keys.
Normally, I type ^ and nothing appears, then I press the space bar and ^ appears, and then I type the next character. The problem arose while I was typing in the command line, but I do not remember the exact sequence of keys. No error message.
Now, when I press ^, it already appears underscored. If I continue typing, everything appears BEFORE the underscored ^. The spacebar has no effect. The backspace key erases that typed text but not the trailing ^. The Enter key does supress the trailing ^ and recovers normal typing (without executing the command).

Connectez-vous pour commenter.

Réponses (2)

Sumukh
Sumukh le 27 Sep 2024
Hi Jose,
You can try out the following workarounds for the issue:
  1. The “power” function can be used instead of the “^” operator.
  2. Disable the dead key sequences. This prevents from using the characters that correspond to these sequences. There are two ways to disable the dead keys: using “setxkbmap” or “dpkg-reconfigure”.
Use setxkbmap
Before starting MATLAB, from the shell prompt type
setxkbmap -variant nodeadkeys
After exiting MATLAB, from the shell prompt type
setxkbmap -variant basic
Use dpkg-reconfigure
Type
dpkg-reconfigure xserver-xfree86
When the system prompts you to select the keyboard variant, choose nodeadkeys.
3. Remap the keys, i.e., use a different key combination for entering the “^” character. This remaps the key for all applications for the entire session, not just for MATLAB. The change only works for the current session, so you must remap the key again after you log off and log back on. Please follow these steps to remap a key using the command “xmodmap”:
  • Determine the key you want to use as a substitute for the “^” operator. For example, you could remap the F11 key to type a caret (^).
  • Use “xmodmap” to see what your current keymap looks like:
xmodmap -pke | more
This displays a table of values and a description of the behavior for each key.
Note the line that contains the key you want to remap. As an example, for a Finnish Keyboard, the line might be:
95 0xffc8 (F11)
  • Find the decimal representation of the ASCII key that you want to map.
Most Linux systems display a map when you run this command:
man ascii
The output includes the following:
The Ascii value of the caret (^) character is decimal 94.
  • Remap the key using xmodmap. To set the F11 key to input a caret (^) character, type:
xmodmap -e "keycode 95 = 94"
  • Test the new key binding.
I hope this helps resolve the issue.

Jose M Soler
Jose M Soler le 27 Sep 2024
Hi Sumukh,
thanks for all your suggestions but I was not able to solve the problem with them.
Incidentally, my key encoding is UTF-8, my ascii decimal number for ^ is 30 and
the key for ^ is Shift+key34 in my keyboard.
I kept exploring different keystroke behaviors:
- The anomalous behavior starts with any dead key (i.e. the accents ',`,",^), not only ^.
- After the anomalous behavior starts, you can input any sequence of characters,
inluding the dead keys (with their normal delayed appearence). But everything appears
before the trailing underscored ^.
- The trailing ^ disappears after you press Enter (without other effects).
- The input string executes normally after a second Enter.
- The problem does not affect the matlab editor, the linux terminal, nor any other
editor or program.
Thus, I have the impression that the problem is not with the key encodings but rather
with a special state of the command line, prompted by the dead keys. I have checked
also the shortcuts but found nothing suspicious (I did not add any).
Incidentally, I have unadvertently used two different MathWorks accounts
(from my home and sabbatical host universities). I apologize for that.

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Produits


Version

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by