* * *

Author Topic: Lazarus 1.8.0 "HHeelloo wwoorrlldd!!" double keystroke syndrome [SOLVED]  (Read 3183 times)

OH1KH

  • New member
  • *
  • Posts: 17
HI!

Just have been forced to install Laz 1.8.0 / fpc 3.0.4 as a project that I'm supporting does compile, but not run any more when compiled with Laz 1.6.4/fpc3.0.2. Resulting binaries give PPI-error at runtime.

So with Laz 1.8.0 compiled they run ok.
But program has an input area that now doubles all keystrokes. Most of edit boxes work ok, but until now at least this one does not.

That would be a "little thing".

Big trouble is that Lazarus source code editor works in same way !!!!

Typing new text to source code editor: h<BS>e<BS>l<BS>l<BS>o gives hello. Without backspaces it is hheelllloo !
Other way to do all editing is external editor and then cut/paste to source code editor.

After some googling I did remove IBus, no help. Installed it again, no help.

Tried to change:
export GTK_IM_MODULE=""
export QT_IM_MODULE=""
export XMODIFIERS="@im=none"

NO help.

Found https://forum.lazarus.freepascal.org/index.php/topic,6231.msg234819.html#msg234819
It is an old chain, but at the end one message from alexander is about year old.
He states that Laz works with command line below. But complied programs have same problem.

GTK_IM_MODULE=gtk-im-context-xim  lazarus

For me this starting way did not give any help at all.

System is Fedora 26  / Openbox-LXDE

Any help !!! Please !!!

--
Saku
OH1KH
« Last Edit: March 09, 2018, 04:43:41 pm by OH1KH »
--
Saku

Cyrax

  • Hero Member
  • *****
  • Posts: 612
Re: Lazarus 1.8.0 "HHeelloo wwoorrlldd!!" double keystroke syndrome
« Reply #1 on: February 19, 2018, 06:29:12 pm »
Open terminal window and paste & execute following clause in there : export | grep LANG

Then paste output of the command here.

Handoko

  • Hero Member
  • *****
  • Posts: 2610
  • My goal: build my own game engine using Lazarus
Re: Lazarus 1.8.0 "HHeelloo wwoorrlldd!!" double keystroke syndrome
« Reply #2 on: February 19, 2018, 06:48:21 pm »
Hello OH1KH,
Welcome to the forum.

You may want to read this:
https://forum.lazarus.freepascal.org/index.php/topic,39213.msg268286.html#msg268286

JD

  • Hero Member
  • *****
  • Posts: 1728
Re: Lazarus 1.8.0 "HHeelloo wwoorrlldd!!" double keystroke syndrome
« Reply #3 on: February 19, 2018, 09:39:53 pm »
Happened to me too. Thanks to others like Handoko, I was able to correct it quickly

See https://forum.lazarus.freepascal.org/index.php/topic,39799.msg274142.html#msg274142

JD
Windows (10, 7) - Lazarus 1.8/FPC 3.0.4, NewPascal, Delphi
Linux Mint Cinnamon  - Lazarus 1.8/FPC 3.0.4, NewPascal

Indy 10.6 series; mORMot; Zeos 7.2.1; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1

ceh2624

  • New member
  • *
  • Posts: 6
Re: Lazarus 1.8.0 "HHeelloo wwoorrlldd!!" double keystroke syndrome
« Reply #4 on: March 07, 2018, 02:54:58 am »
The simplest solution is often the best one...
Go to Konsole or your favourite bash shell and type in this command: ibus exit

OH1KH

  • New member
  • *
  • Posts: 17
Re: Lazarus 1.8.0 "HHeelloo wwoorrlldd!!" double keystroke syndrome
« Reply #5 on: March 08, 2018, 11:23:13 am »
Hi!
I removed IBUS. Did not hep.
Played some time with input method selector (logged in and out) and suddenly at some point double echo disappeared.
I am not sure what made it.

Btw someone asked to  export | grep LANG and paste here:
declare -x LANG="fi_FI.UTF-8"

So everything LOOKS now OK. But it is just a look !
At the program there is TMemo that has action "OnKeyPress" in use.

It calls subroutine that gets "key:char" as parameter.
Purpose is to send that char as CW (=morse code). Now when typing to memo text looks normal: "hello world",
but subroutine sends it morse code as "hheelloo  wwoorrlldd".

Subroutine gets called twice for every key press while it should be called only once.
Source has not been touched, and linux is not updated (upd only Lazarus/FPC) and this program part worked completely ok compiled with Lazarus 1.6.4/Fpc3.0.2

But not any more with 1.8.0/3.04. Sad but true!
I have no more ideas.
And googling this kind of event gives lot more less than with double echo on screen. (I do not even have idea what search words to use for this case)

--
Saku
--
Saku

Thaddy

  • Hero Member
  • *****
  • Posts: 6923
Re: Lazarus 1.8.0 "HHeelloo wwoorrlldd!!" double keystroke syndrome
« Reply #6 on: March 08, 2018, 11:47:21 am »
It is not related to FPC it is a known Fedora issue.
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

OH1KH

  • New member
  • *
  • Posts: 17
Re: Lazarus 1.8.0 "HHeelloo wwoorrlldd!!" double keystroke syndrome
« Reply #7 on: March 08, 2018, 05:35:30 pm »
If it is "known Fedora issue" please give some words to google to get right hit for that.
Thank you.
--
Saku

Thaddy

  • Hero Member
  • *****
  • Posts: 6923
Re: Lazarus 1.8.0 "HHeelloo wwoorrlldd!!" double keystroke syndrome
« Reply #8 on: March 08, 2018, 05:51:23 pm »
Are you serious??? If you use Fedora you would know about https://bugzilla.redhat.com/index.cgi
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

OH1KH

  • New member
  • *
  • Posts: 17
Re: Lazarus 1.8.0 "HHeelloo wwoorrlldd!!" double keystroke syndrome
« Reply #9 on: March 08, 2018, 06:15:21 pm »
That does not lead to anywhere.
With "double keyboard events" I have 44 hits and with quick look  none seems to be related to this.
 I do not feel bugzilla very good fix source. More just place for complain/feedback to developers.

Just one thing I forgot to say:
It is only letters that double them selfs, not numbers.

And I can not understand that same source compiled in same computer works with 1.6.4/3.0.2 but not with 1.8.0/3.0.4
My opinion is that Laz/FPC has the problem.
Either the old version had fault (and so produced a working program) or the new version has the fault.

Not Fedora or source, that has not changed at all during Laz/fpc upgrade.

As this is not leading to anywhere I have to start  thinking some kind of filter inside the subroutine. It is just a bit tricky as sometimes there really are words with 2 same letters besides. Depending what language is used there may be many of those words.

--
Saku

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3515
  • I like bugs.
Re: Lazarus 1.8.0 "HHeelloo wwoorrlldd!!" double keystroke syndrome
« Reply #10 on: March 08, 2018, 06:39:49 pm »
Played some time with input method selector (logged in and out) and suddenly at some point double echo disappeared.
I am not sure what made it.
So it works now, right? I think everybody with the problem have been able to fix it so far by tweaking IBUS or whatever settings.
I personally have not experienced it, maybe because I use KDE. Everything just works here. :)

Do you need both Lazarus 1.6.0 and 1.8.0 in the same computer?
There is no quick fix coming for the problem because nobody understands the LCL-GTK2 code enough. There were attempts to fix it, but a fix for one machine caused it appear in another machine. Welcome to GTK2 ...
See the issue:
 https://bugs.freepascal.org/view.php?id=30863
and its related issues.

JD

  • Hero Member
  • *****
  • Posts: 1728
Re: Lazarus 1.8.0 "HHeelloo wwoorrlldd!!" double keystroke syndrome
« Reply #11 on: March 08, 2018, 07:11:46 pm »
As this is not leading to anywhere I have to start  thinking some kind of filter inside the subroutine. It is just a bit tricky as sometimes there really are words with 2 same letters besides. Depending what language is used there may be many of those words.

Did you try what I did in the link I posted above? It solved it for me.

JD
Windows (10, 7) - Lazarus 1.8/FPC 3.0.4, NewPascal, Delphi
Linux Mint Cinnamon  - Lazarus 1.8/FPC 3.0.4, NewPascal

Indy 10.6 series; mORMot; Zeos 7.2.1; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1

OH1KH

  • New member
  • *
  • Posts: 17
Re: Lazarus 1.8.0 "HHeelloo wwoorrlldd!!" double keystroke syndrome
« Reply #12 on: March 09, 2018, 05:41:12 am »
I think I know now how Lazarus (fpc) is changed. This is simple test that I did and it shows the problem. It is partially copy of the program in question

Code: Pascal  [Select]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
  9.  
  10. type
  11.  
  12.   { TForm1 }
  13.  
  14.   TForm1 = class(TForm)
  15.     Memo1: TMemo;
  16.     Memo2: TMemo;
  17.     procedure Memo1KeyPress(Sender: TObject; var Key: char);
  18.   private
  19.  
  20.   public
  21.  
  22.   end;
  23.  
  24. var
  25.   Form1: TForm1;
  26.  
  27. implementation
  28.  
  29. {$R *.lfm}
  30.  
  31. { TForm1 }
  32.  
  33. procedure TForm1.Memo1KeyPress(Sender: TObject; var Key: char);
  34.   var s : string;
  35. begin
  36.   if key <> '' then
  37.    Begin
  38.     key := UpperCase(key)[1];
  39.    end;
  40.   if (key in ['A'..'Z']) or (key in ['0'..'9']) or (key = '=') or
  41.    (key = '?') or (key = ',') or (key='.') or (key='/') or (key = ' ') or
  42.    (key = '<') or (key = '>') or (key = ':') or (key = ')') or (key = '(') or
  43.    (key = ';') or (key = '@') or (key = 'ß') or (key ='Ü') or (key ='Ö') or
  44.    (key = 'Ä') then
  45.   begin
  46.     Memo2.Lines.Add(key);
  47.   end;
  48. end;
  49. end.
  50.                                    
  51.  

Now the difference lays in UTF-8 (was not in Laz 1.6.4), I think.
This does not work any more:
    key := UpperCase(key)[1];

If that is commented out typing letters (with caps locked) produces just one echo to Memo2.
If it is there then double echo to Memo2 happens.

Now I just have to find a way to upcase the key.
NO!!!   UTF8UpperCase(key)[1]; does NOT work!! There must be some other way to do it.
--
Saku

dbannon

  • Sr. Member
  • ****
  • Posts: 305
Re: Lazarus 1.8.0 "HHeelloo wwoorrlldd!!" double keystroke syndrome
« Reply #13 on: March 09, 2018, 06:44:45 am »
Hmm, I just tried your code on Ubuntu with 1.8.0 and I saw double char.

So, instead of messing with Key, I declared a new, 'MyKey', copied contents of key to it and used that in the code (actually only the A..Z test) and it worked fine.

Code: Pascal  [Select]
  1. procedure TForm1.Memo1KeyPress(Sender: TObject; var Key: char);
  2. var s : string;
  3.     MyKey : char;
  4. begin
  5.   MyKey := Key;
  6. if Mykey <> '' then  Begin
  7.   Mykey := UpperCase(key)[1];
  8.  end;
  9.  if (Mykey in ['A'..'Z']) or (key in ['0'..'9']) or (key = '=') or
  10.  (key = '?') or (key = ',') or (key='.') or (key='/') or (key = ' ') or
  11.  (key = '<') or (key = '>') or (key = ':') or (key = ')') or (key = '(') or
  12.  (key = ';') or (key = '@') or (key = 'ß') or (key ='Ü') or (key ='Ö') or
  13.  (key = 'Ä') then
  14. begin
  15.   Memo2.Lines.Add(Mykey);
  16. end;
  17. end;

In fact the procedure is called twice (it must be Key can only hold one key press) when you get your double chars, that says to me the underlying system is reacting to you changing Key.

(might be nicer to put all those test characters in one set ...)

Davd
Lazarus 1.8, Linux (and reluctantly Win10, OSX)

OH1KH

  • New member
  • *
  • Posts: 17
Hi!

Simple solution, but hard to find.
Tried 10^n variations to make locase to upcase without making doubling. No luck.

Something has changed because now var Key works "backwards" pushing upcase to key event.

Thanks for help !
--
Saku

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus