Lazarus 1.8.0RC3 - IDE Editor - Cursor not visible - Raspberry Pi 3 lazarus / 9-Editor ---------------------------------------------------------------------- ertank · 2017-07-30 11:11 Hello, I am using Lazarus mainly on Raspberry Pi - Jessie (Linux raspberrypi 4.9.24-v7+ #993 SMP Wed Apr 26 18:01:23 BST 2017 armv7l GNU/Linux). I have no problem after a reboot of the OS. I start working with Lazarus and after a while I see no cursor on the Editor window. I can still type, delete, select, etc. I can see my column and row numbers are changing when moving the cursor in editor file. I simply cannot see my cursor blinking. I could not understand how exactly problem happens. However, it happens like always after a while. Setting Option "Always visible cursor" did not help me. Problem is only with Lazarus Editor. Switching to a browser of a TextEditor, and I can see my cursor blinking in there. My searches in the internet did not help much. I feel like I am the only person having such a problem. Therefore, I wanted to give it a try making my problem public. Are there anybody out there having such a problem of cursor not visible? If yes, do you have a solution? As I do not know how to reproduce the problem, I cannot post a bug report about this in mantis which also makes me feel like I need to live with it. Any help is appreciated. Thanks & regards, Ertan ---------------------------------------------------------------------- Thaddy · 2017-07-30 11:21 I am currently using linux-arm: it does not have the problem. Yesterday I was on win64: it dd not have the problem. I am using trunk, though (1.9, with FPC trunk r36814) ---------------------------------------------------------------------- Martin_fr · 2017-07-30 11:50 Did you use other versions of Lazarus in the past? e.g. 1.6.4 ? Did the problem happen with any of them? Please (re-)compile your IDE with the following settings: -Criot -gh -gw -gttt -Sa -O- Start your IDE from a console/shell and set the environment HEAPTRC="keepreleased" Note the HEAPTRC="keepreleased"  will eat a lot of memory over time, and you may only be able to run for a short time. If that is the case, then skip setting it. If you run from console, you should see some output there. If there are any stacktraces, then copy them and past them here. If you do not run from console, use lazarus --debug- log=/home/yourname/laz.log or similar. If the issue goes away, the recompile and change the settings to -Criot -gh -gw -gttt -Sa -O1 and again test, and if ok increase the last bit to -O2 and then -O3 ------------------------------- When you have the IDE in a state that fails, go to menu: tools > options, then page: Editor > Display > Markup and Matches and disable "Outline (global) ------------------------------- RC1 had a similar issue, the caret was shown, but at a wrong location. But I thought it was fixed / I had no feedback though. ---------------------------------------------------------------------- ertank · 2017-07-30 12:22 Quote from: Martin_fr on July 30, 2017, 01:50:42 pmDid you use other versions of Lazarus in the past? e.g. 1.6.4 ? Did the problem happen with any of them? I started to use Lazarus on Raspberry with 1.8.0RC1 Quote from: Martin_fr on July 30, 2017, 01:50:42 pmPlease (re-)compile your IDE with the following settings: -Criot -gh -gw -gttt -Sa -O- Do you mean to use a command line like below to (re)-compile? Code: [Select]make bigide -Criot -gh -gw -gttt -Sa -O- Quote from: Martin_fr on July 30, 2017, 01:50:42 pmStart your IDE from a console/shell and set the environment HEAPTRC="keepreleased" Note the HEAPTRC="keepreleased"  will eat a lot of memory over time, and you may only be able to run for a short time. If that is the case, then skip setting it. I think I do not want to try this before trying re-compiling and saving a log file. Quote from: Martin_fr on July 30, 2017, 01:50:42 pmIf you run from console, you should see some output there. If there are any stacktraces, then copy them and past them here. If you do not run from console, use lazarus --debug- log=/home/yourname/laz.log or similar. I do run from console. However, it is not possible to read output easily. Making Lazarus keeping a log file would be more convenient. Quote from: Martin_fr on July 30, 2017, 01:50:42 pmIf the issue goes away, the recompile and change the settings to -Criot -gh -gw -gttt -Sa -O1 and again test, and if ok increase the last bit to -O2 and then -O3 I hope to have it fixed by recompiling or else, I presume checking log file will be a pain. Quote from: Martin_fr on July 30, 2017, 01:50:42 pm------------------------------- When you have the IDE in a state that fails, go to menu: tools > options, then page: Editor > Display > Markup and Matches and disable "Outline (global) You above suggestions, I will be looking at them if  I can find a point it works & another point where it doesn't. Quote from: Martin_fr on July 30, 2017, 01:50:42 pm------------------------------- RC1 had a similar issue, the caret was shown, but at a wrong location. But I thought it was fixed / I had no feedback though. Maybe that's it. Assuming that caret is shown in a location so wrong that I cannot even see it. BTW, What I could find is basically below link about the situation. If that rings anything to anybody. http://lists.lazarus.freepascal.org/pipermail/lazarus/2008- August/037756.html ---------------------------------------------------------------------- Martin_fr · 2017-07-30 14:41 QuoteDo you mean to use a command line like below to (re)-compile? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i make bigide -Criot -gh -gw -gttt -Sa -O- I think it is more like Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i make bigide OPT="-Criot -gh -gw -gttt -Sa -O-" Not 100% sure, I usually build via the tools menu. There is an entry "configure build lazarus", where you can set the options, and start the compile QuoteI do run from console. However, it is not possible to read output easily. Making Lazarus keeping a log file would be more convenient.Then use the --debug-log=file option QuoteI hope to have it fixed by recompiling or else, I presume checking log file will be a pain.you would just be looking for something like Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Stack trace:  $00439E86  $00439E33  $004D47C4  TCONTROL__CLICK,  line 2251 of ./include/control.inc  $0050391F  TBUTTONCONTROL__CLICK,  line 62 of ./include/buttoncontrol.inc  $00503E46  TCUSTOMBUTTON__CLICK,  line 174 of ./includeshould not be too hard to spot. Then post it to the forum (or IF the log has a trace, attach the whole log) --- For reference, the RC1 I refered to: http://forum.lazarus- ide.org/index.php/topic,36907.msg246796.html#msg246796 ---------------------------------------------------------------------- Martin_fr · 2017-07-30 14:50 QuoteProblem is only with Lazarus Editor. Switching to a browser of a TextEditor, and I can see my cursor blinking in there. Yes Lazarus paints its own caret (cursor). So this is nothing to do with the system caret. I assume, that restarting the IDE fixes the issue (temporarily)? ---------------------------------------------------------------------- ertank · 2017-07-30 17:29 Oddly enough, restarting the IDE is not fixing my problem. ---------------------------------------------------------------------- Martin_fr · 2017-07-30 18:56 This is really odd. The caret is just a paint operation (paint xor). So I assumed that if it is not painted, then something in the IDE gets corrupted. But that would be fixed by a restart. If it persists, then it is likely that none of my suggestion will help at all. (They were mostly to track memory corruption) Something must be allocating a resource from the OS. Or otherwise affecting the OS. Unfortunately not my area of expertise. Are you using gtk or qt? You can try this. Open the file components\synedit\syneditpointclasses.pas go to line 2885 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TSynEditScreenCaretPainterInternal.Init;begin  {$IFDEF LCLCarbon}    FForcePaintEvents := True;  {$ELSE}  {$IF DEFINED(LCLQt) OR DEFINED(LCLQt5)}    FForcePaintEvents := True;  {$ELSE}    FForcePaintEvents := False;  {$ENDIF}  {$ENDIF}     FForcePaintEvents := True; // insert this line, always TRUE   FSavePen := TPen.Create;  FColor := clBlack;  FOldY := -1;  FCanPaint := True;  inherited Init;end; Save the file with the added line. Recompile the IDE And hope for the best. ------------ Or try this / not recommended. ( it disables the multi caret mode) open ide\sourcesyneditor.pas line 1660... Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i constructor TIDESynEditor.Create(AOwner: TComponent);var  MarkupFoldColors: TSynEditMarkupFoldColors;begin  inherited Create(AOwner);  FUserWordsList := TFPList.Create;  FTemplateEdit:=TSynPluginTemplateEdit.Create(Self);  FSyncroEdit := TSynPluginSyncroEdit.Create(Self);  FMultiCaret := TSynPluginMultiCaret.Create(Self);  FMultiCaret.MouseActions.Clear; // will be added to SynEdit  FMultiCaret.KeyStrokes.Clear;  replace "Self" with "nil" / this will leak some memory.... (or edit the entire file, and remove all stuff to do with FMultiCaret) Not sure, not tested. ---------------------------------------------------------------------- ertank · 2017-07-30 19:09 As expected, recompiling did not succeed. My log file is below and I do not see any cursor at the time Lazarus loads. Code: [Select]Hint: (lazarus) [TMainIDE.ParseCmdLineOptions] PrimaryConfigPath="/home/pi/.lazarus" Hint: (lazarus) [TMainIDE.ParseCmdLineOptions] SecondaryConfigPath="/etc/lazarus" Hint: (lazarus) [TBuildManager.SetBuildTarget] Old=arm-linux-gtk2 New=arm-linux-gtk2 FPC=True LCL=False TComponentTreeView.SetSelection: Updating component node values. FindMissingClass DB:TZConnection IsInherited=False FindMissingClass qry:TZQuery IsInherited=False FindMissingClass qryOnayHicSayimVarMi:TZReadOnlyQuery IsInherited=False FindMissingClass ZSQLMonitor1:TZSQLMonitor IsInherited=False FindMissingClass sqlErrorInsert:TZSQLProcessor IsInherited=False TLazSourceFileManager.LoadLFM loading nested class TZSQLProcessor needed by /home/pi/myprojectudata.pas TLazSourceFileManager.LoadComponentDependencyHidden /home/pi/myproject/udata.pas AComponentClassName=TZSQLProcessor AComponentClass=nil AncestorClass=nil LFMFilename= NOTE: Window with stalled focus found!, faking focus-out event TLazSourceFileManager.LoadLFM DoLoadComponentDependencyHidden NestedClassName=TZSQLProcessor failed for /home/pi/myproject/udata.pas NOTE: Window with stalled focus found!, faking focus-out event LAZARUS END - cleaning up ... Hint: (lazarus) [TMainIDE.Destroy] B  -> inherited Destroy... TMainIDE Hint: (lazarus) [TMainIDE.Destroy] END Ont thing that might give an idea is maybe that NOTE lines. Have no idea though. As you can see above, I am using gtk2. Will try your source modifications (only the first modification) and see if helps. ---------------------------------------------------------------------- Thaddy · 2017-07-30 19:35 DO NOT modify. You say you are using a Raspberry Pi? A proper install on Raspbian should work. It never failed me. If you want I can prepare a tar for you. BTW: Is your Raspbian up to date? Code: [Select]sudo apt-get update && sudo apt-get dist-upgrade -y 1) Note you need a swap file for Lazarus to compile to a finish (about the same as the memory will do so 1024) 2) Ignore notes and warnings... they are not for you...yet... Written on a ff'ng Raspberry Pi 3B. (Laz 1.9/fpc311 from today) [edit] RC3 does not have the problem either....I just tested. ---------------------------------------------------------------------- ertank · 2017-07-30 19:59 Hi Thaddy, I believe it is about a month or less than two since I updated my whole system. Code: [Select]Linux raspberrypi 4.9.24-v7+ #993 SMP Wed Apr 26 18:01:23 BST 2017 armv7l GNU/Linux I do not know how to get installed package names with their versions. Not a hardcode Linux user I am. If my memory serves me right, I have this problem for about 3 months (since I begin developing that Raspberry application). It is just today I have posted it in the forum. Just had enough of it probably. I can build lazarus just fine. I have a 1000Mb swap file. I meant suggestion failed on me. Sorry for the confusion. ---------------------------------------------------------------------- Thaddy · 2017-07-30 20:34 Linux raspberrypi 4.9.24-v7+ #993 SMP Wed Apr 26 18:01:23 BST 2017 armv7l GNU/Linux? That's old. Upgrade: sudo apt-get update && sudo apt-get dist-upgrade -y You will be much happier (and safer)... Anyway, if you still have the issue tomorrow I can prepare a package. ---------------------------------------------------------------------- ertank · 2017-07-30 21:17 Quote from: Martin_fr on July 30, 2017, 08:56:34 pmYou can try this. Open the file components\synedit\syneditpointclasses.pas go to line 2885 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TSynEditScreenCaretPainterInternal.Init;begin  {$IFDEF LCLCarbon}    FForcePaintEvents := True;  {$ELSE}  {$IF DEFINED(LCLQt) OR DEFINED(LCLQt5)}    FForcePaintEvents := True;  {$ELSE}    FForcePaintEvents := False;  {$ENDIF}  {$ENDIF}     FForcePaintEvents := True; // insert this line, always TRUE   FSavePen := TPen.Create;  FColor := clBlack;  FOldY := -1;  FCanPaint := True;  inherited Init;end; Save the file with the added line. Recompile the IDE Above is kind of an improvement. When re-starting after having a cursor not visible problem, I sometimes have a cursor. ---------------------------------------------------------------------- ertank · 2017-07-31 09:52 I have updated Raspberry Pi to latest last night. I read that there are very minor changes for gtk2 libraries. I have re-compiled Lazarus with default source codes from SVN with using "make bigide" and no additional parameters. Unfortunately, same problem continues. Cursor is visible at first. After a while, it vanishes. Although, I see that after updating my operating system cursor is visible after each run of Lazarus. It simply disappears after sometime of usage. One last thing I would like to try is to use Lazarus with sources from trunk. ---------------------------------------------------------------------- Martin_fr · 2017-07-31 12:46 You may try the I don't think  it FForcePaintEvents  again. ---- You may also try to compile with   -dSynCaretDebug and run a logfile. The close the IDE as soon as the caret disappears, and post the logfile here. ---- I am not sure either will do much good, but... ---------------------------------------------------------------------- ertank · 2017-11-01 18:56 Hello, @Martin_fr, I couldn't find available time to try. However, I also doubt that it will be much of a help. Will test as soon as I find some time though. What I realize recently is, Editor tabs (unit names) can get focus and draw it very much like when a button get focus. This kind of identification is not happening if editor cursor is invisible. Editor tabs also gets invisible focus if clicked or switched to. This is really getting more and more annoying as I have to work on the device. It is hard to keep track when it gets lost as I have to focus on coding (time being not enough as usual). I will share some more feedback here with updated OS (currently Jessie, will be Stretch) and updated Lazarus (will be 1.8.0RC5). Hardware will be same with one minor difference of it will be booting and completely running on a fast USB stick this time. ---------------------------------------------------------------------- Martin_fr · 2017-11-01 19:05 I don't know about focus to tabs (though I think I saw that a long time before already). About the caret. (I assume cursor = text cursor = caret). This issue (well an issue with those symptoms) has occurred on various GTK systems. And a fix is in revision 55941. This is already included in RC5. -- EDIT: only read the last post of you / didnt see I already mentioned this in this thread. Anyway check RC5... maybe. ---------------------------------------------------------------------- Martin_fr · 2017-11-01 19:12 In case it is a focus issue (the editor only shows the caret, when focused). If the editor thinks that it is not focused, then it would hide it. There is a setting: Tools > Options > Editor > General: "Persistent cursor" -- Edit If it is a focus issue, then it needs to be reported as such (as then it is widgetset, not SynEdit). If you compile with -dVerboseFocus and have the logfile (or output to console) then SynEdit will print when it get/looses focus. ---------------------------------------------------------------------- ertank · 2017-11-17 21:35 I didn't have cursor invisible problem so far. I assume problem was that Source Editor was not thinking it has the focus and therefore no cursor drawn. Though, arrow keys or typing something triggers events and I could type or walk in code. I believe that problem of "thinking not having focus" fixed somewhere between 1.8.0RC3 and 1.8.0.RC5 which introduced problem discussed in below thread. https://forum.lazarus.freepascal.org/index.php/topic,38787.0.html After new introduced problem is fixed (I am using bug tracker suggested patch now), everything seems to be fine and no more cursor not visible problem for me.