Syncompletion lazarus / 5-Lazarus Extra Components ---------------------------------------------------------------------- redge · 2009-09-20 15:53 Hello I'm on Ubuntu 9.04, lazarus 0.9.27-0-20090831 beta. After using TSynCompletion, the SynEdit doesn't want to write the first Char, but after the first Char all works.  I only find in mail- archive.com/lazarus@lazarus.freepascal.org/msg05723.html, messages who talk of the subject; but i don't understand what i must do to set the components. I want to write this first char  . Thank you.. ---------------------------------------------------------------------- Martin_fr · 2009-09-20 17:19 I don't recall if anything was fixed since the mail you quoted. Except, yes, if the SynCompletion issue is still the same it would now be present for all (except maybe some umlaute) chars, because the limitation to upper-case was "fixed" (that is SynEdit.OnKeypress now works for lowercase too). Can you attach a small example program, please? Or maybe report it as a bug? ---------------------------------------------------------------------- redge · 2009-09-20 19:49 A little example, quickly made: unit Unit1; {$mode objfpc}{$H+} interface uses   Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,   SynEdit,SynCompletion; type   { TForm1 }   TForm1 = class(TForm)     SynEdit1: TSynEdit;     completion: TSynCompletion;     procedure FormCreate(Sender: TObject);   private     { private declarations }   public     { public declarations }   end; var   Form1: TForm1; implementation { TForm1 } procedure TForm1.FormCreate(Sender: TObject); begin      completion:=TSynCompletion.Create(self);         completion.Editor:=SynEdit1;         completion.ItemList.Add('tree');         completion.ItemList.Add('leaves'); end; initialization   {$I unit1.lrs} end.                                              Thanks. ---------------------------------------------------------------------- Martin_fr · 2009-09-20 20:27 Just tried it. Works for me. Or at least the way I expected it. typing:   tr ctrl-space return x results in   treex when the list is open, I can press enter to select an item from the list. the item is inserted, the enter ignored (no new line, that is what I expect) and the next char I type is inserted normally. However, that is the same for all "endoftokenchar", so the selection can be chosen via space, or ()[] too, and those are eaten. they confirm the selction, that is why they are not inserted. so typing:   tr ctrl-space SPACE x results in   treex without the space between tree and x If that is what you mean. if you want the char that makes the selection (such as an opening bracket) to appear together with the selection => that is not implemented. Otherwise, if you mean you do not see the "x" that you input after pressing return, please provide key by key example => so it can be reproduced ---- But yes, the whole support for synedit as comonent and especially for syncomplet / synautpcomplete is lagging behind. All recent work on synedit was only to improve it inside the IDE itself. This is also why syncomplete is not (yet) in the component bar. Simple because no one had yet taken the time to look after it. ---------------------------------------------------------------------- redge · 2009-09-20 20:49 Yes, that the way i expected it, but it doesn't work for me: typing:   tr ctrl-space return x results in   tree  I must type an other x. Its the same results with all chars. ---------------------------------------------------------------------- Martin_fr · 2009-09-22 20:11 ok, the this is a bug. you specified your version as: "I'm on Ubuntu 9.04, lazarus 0.9.27-0-20090831 beta." Can you please get the SVN revision (laz and fpc) from the about dialog (help => about) I have tested this with the current version, but I am almost sure there was no fix to this pat of synedit in the last month. So we should have had the same result. ---------------------------------------------------------------------- redge · 2009-09-23 16:26 OK lazarus 0.9.27-0-20090831 beta. date:2009-08-31 version FPC: 2.2.4 Revision SVN: unknwon x86_64-linux-gtk2 (beta) from the software repository  http://www.hu.freepascal.org/lazarus/  lazarus-testing universe ---------------------------------------------------------------------- Martin_fr · 2009-09-23 17:12 Strange. http://www.hu.freepascal.org/lazarus/ should be up to date. I tested on Windows. But afaik this code has nothing that is OS related. If I find some time I may test on ubuntu. ---------------------------------------------------------------------- Martin_fr · 2009-09-23 17:22 Just tested. yes, it has a bug under ubuntu (or probably under gtk). ---------------------------------------------------------------------- Martin_fr · 2009-09-24 00:05 I have created a bug entry for this issue: http://bugs.freepascal.org/view.php?id=14667 In the meantime there may be a workaround. But i have not tested it in depth. On the surface it appears to work in gtk2 (may depend on selected keymap or font?) and windows In  components\synedit\syncompletion.pas locate  procedure TSynCompletion.EditorKeyDown(Sender: TObject; on line 1451 you should see         TRecordUsedToStoreEachEditorVars(fEditstuffs^).NoNextKey := true; Comment this line out, and it should work. It seems this line was to prevent the ctrl-space from inserting a space. and probably this is now prevented at an earlier stage already => so now it eats the key after completion. But I have not verified this claim. ---------------------------------------------------------------------- redge · 2009-09-26 16:10 Thank you for your help. Today, i comment the line 1451: but i have the same result. ---------------------------------------------------------------------- Martin_fr · 2009-09-26 16:58 you got the one inside the IFDEF SYNLAZ ? (and obviously: recompiled lazarus, including synedit?) Or to be on the save side comment them both out. alternatively, find the 2 occurrences of     if TRecordUsedToStoreEachEditorVars(fEditstuffs^).NoNextKey then begin       key := #0;     end; and remove those. ---------------------------------------------------------------------- redge · 2009-09-26 17:29 recompiled lazarus  > Yes, That works ... I'm a newbiiiiiiiiiiiiiiie.  Thank you for your help. Cool, i can terminate my application.