Recent

Author Topic: Spontaneous remapping of "i" and "m" keys  (Read 504 times)

del

  • Jr. Member
  • **
  • Posts: 85
Spontaneous remapping of "i" and "m" keys
« on: September 13, 2019, 12:17:29 pm »
All of a sudden now when I type lowercase "i" in the editor it inserts a tab in front of it. And when I type lowercase "m" in the editor it inserts a carriage return in front of it. Here's what I just typed - you can see what happened when I typed "i" and "m". (The carriage return after the number "0" was normal, the rest are "automatic" when I type the "m").

Quote
abcdefgh   ijkl
mnopqustuvwxyz1234567890
   ijkl
mjkl
mkl
ml
m
m
m
m
mMMMMMMMIIIIIIII

This is really distracting. What did I do to mess this up? I closed Lazarus and reopened it and the problem is still there.

rvk

  • Hero Member
  • *****
  • Posts: 3836
Re: Spontaneous remapping of "i" and "m" keys
« Reply #1 on: September 13, 2019, 12:31:39 pm »
See if this is also the case in Notepad (Start > type notepad + enter)

Restart your computer and see if it's still there.

If it is, shut down your computer again, clean your keyboard (usually pressing hard on all keys will clean it a bit) and restart the computer to see if the problem remains.


del

  • Jr. Member
  • **
  • Posts: 85
Re: Spontaneous remapping of "i" and "m" keys
« Reply #2 on: September 13, 2019, 12:38:49 pm »
OK - I'm on Linux and tried to repeat this behavior using Geany but the behavior of the keys "i" and "m" was normal. I'll try restarting the computer and see if that clears it. Thanks.

winni

  • Sr. Member
  • ****
  • Posts: 328
Re: Spontaneous remapping of "i" and "m" keys
« Reply #3 on: September 13, 2019, 12:45:08 pm »
Sound like you get an unwanted CTRL key: Ctrl I is TAB and Ctrl M is carriage return.

Lift off both Ctrl keys on the keyboard and look if something has fallen into the keyboard: paper clip?

del

  • Jr. Member
  • **
  • Posts: 85
Re: Spontaneous remapping of "i" and "m" keys
« Reply #4 on: September 13, 2019, 12:58:29 pm »
I shut the computer off. Did some things. Restarted the computer. Now the problem is gone:

Quote
abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ

So it was just some crazy thing. But THANKS !!! I get so much joy out of FPC / Lazarus. And I learn a lot just browsing this forum.  :)

Kays

  • Full Member
  • ***
  • Posts: 182
  • Whasup!?
    • KaiBurghardt.de
Re: Spontaneous remapping of "i" and "m" keys
« Reply #5 on: September 13, 2019, 10:15:26 pm »
[…] Now the problem is gone: […]
Maybe lack of ECC memory? The other day I had some crazy problem with my keyboard, too: After a pm-suspend-hybrid(8) phase some keys of my external keyboard had a different mapping, whilst all other keys and the internal keyboard had the correct layout. Re-plugging the keyboard or re-loading the mapping did not make a difference, nor did another short pm-suspend(8). Only a reboot(8) “solved” the issue.
Yours Sincerely
Kai Burghardt

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5633
    • wiki
Re: Spontaneous remapping of "i" and "m" keys
« Reply #6 on: September 14, 2019, 12:59:13 am »
https://bugs.freepascal.org/view.php?id=29432

The issues is known. But apparently very rare.

del

  • Jr. Member
  • **
  • Posts: 85
Re: Spontaneous remapping of "i" and "m" keys
« Reply #7 on: September 14, 2019, 01:20:15 am »
Well I just came back to say that the problem briefly returned:

"i" = /t
"m" = /n

but this time I was able to clear it by just closing Lazarus, then reopening it. Anyway I'm having a riot with this awesome IDE - no complaints.  :)

Oops - forgot to mention, from help about:

Version #: 2.0.4
Date: 2019-09-06
FPC Version: 3.0.4

SVN Revision: Unversioned directory

x86_64-linux-gtk2
« Last Edit: September 14, 2019, 01:26:22 am by del »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5633
    • wiki
Re: Spontaneous remapping of "i" and "m" keys
« Reply #8 on: September 14, 2019, 04:01:31 am »
Its a long time I looked at the gtk parts of the IDE code.....

IIRC there were some tricky bits in handling the ctrl key.  (and some other modifiers). It is possible that some of this goes wrong under some conditions.... But I have no idea.

If it becomes to bad:
- Try QT
- try pressing and releasing, each of the 2 ctrl keys.
- Find some of the related bug reports about double key presses. There is a "set env" in one of them, to disable using some inputmethod from the OS. Big maybe.... no idea...

Try to remember if you used the ctrl key before it started, and how you used it.
Maybe (like on windows ctrl-tab) switching application via keyboard. So Lazarus would not see the release of the tab key. (Still the OS should know...)

If you find ways to reproduce, or other clues, add to the bug report.

You can also run the IDE from a terminal to see the IDE log output.
And there are various conditional compiles to get more feedback, but I am not sure which exactly. grep the lazarus sources for IFDEF and either KEY or PRESS
I think something like VERBOSE_KEYS or similar. Then build the IDE with it defined: -dVERBOSE_KEYS

Sorry it is a bit vague...

del

  • Jr. Member
  • **
  • Posts: 85
Re: Spontaneous remapping of "i" and "m" keys
« Reply #9 on: September 14, 2019, 07:00:39 am »
Thanks for the suggestions. I frequently use the left ctrl key (ctrl-c) copy, (ctrl-v) paste, (ctrl-s) to save. And I even more frequently use the tab key for indents (we use tab indents at work so I try to keep my habits consistent). I'll launch Lazarus from the command line. I'll post anything I learn - thanks again.
« Last Edit: September 14, 2019, 07:09:59 am by del »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5633
    • wiki
Re: Spontaneous remapping of "i" and "m" keys
« Reply #10 on: September 14, 2019, 12:07:42 pm »
I had a look, for more verbose logging, compile the IDE with
-dVerboseKeyboard -dVerboseKeys

and (if compiles) -dVerboseModifiermap

---
There are also alternative implementations, but they are ages old, and likely will not compile / And I have no idea what they do, or if they will affect you (if they still work....)
-dUseOwnShiftState

and/or
-dUse_KeyStateList

del

  • Jr. Member
  • **
  • Posts: 85
Re: Spontaneous remapping of "i" and "m" keys
« Reply #11 on: September 15, 2019, 05:24:56 pm »
Thanks for the suggestions. I've been launching it from the command line (startlazarus) and haven't seen any problems after over 18 hours of intense coding. So the problem is not really at nuisance level. If I do get any clues I'll post them.  :)