synedit lazarus / 66-Unix ---------------------------------------------------------------------- scasparz · 2025-11-05 00:26 Hi guys, am Linux Mint 22.1, with the latest lazarus for debian downloaded from sourceforge. Am trying to add a new bookmark on FEtSynEdit, a tsynedit descendant using this: 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   IF FEtSynEdit.IsBookmark(zindex)    THEN FEtSynEdit.ClearBookMark(zindex);   FBookMarksArray[zindex] := tSynEditMark.Create(FETSynEdit);  FBookMarksArray[zindex].ImageList := FBookMarksImageList;  FBookMarksArray[zindex].ImageIndex := zindex;  FBookMarksArray[zindex].BookmarkNumber := zindex;  FBookMarksArray[zindex].Column:= FETSynEdit.CaretX;  FBookMarksArray[zindex].Line := FETSynEdit.CaretY;  FBookMarksArray[zindex].Visible := True;  FETSynEdit.Marks.Add(FBookMarksArray[zindex]); //point(1)   if FEtSynEdit.IsBookmark(zindex) then information('ok') else information('not ok'); //point(2) Following the addition of the new bookmark as on point(1) , point(2) returns ‘not ok’. Looks like the new bookmark was not inserted. To make it work, reluctantly I had to downgrade to Lazarus 3.0 as provided by Debian (rather than sourceforge). Any ideas please? s ---------------------------------------------------------------------- paweld · 2025-11-05 05:38 It stopped working after commit: https://gitlab.com/freepascal.org/laz arus/lazarus/- /commit/77c4b7ceaecbdd14f43665d265a65e3990f05da2#1e0b7352ad5a0ae20b96b 260ddfe37ec08a672d1_363_395 To achieve the same effect as before the changes in syneditmarks, change the code as follows: 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 IF FEtSynEdit.IsBookmark(zindex)    THEN FEtSynEdit.ClearBookMark(zindex);   FBookMarksArray[zindex] := tSynEditMark.Create(FETSynEdit);  FBookMarksArray[zindex].ImageList := FBookMarksImageList;  FBookMarksArray[zindex].ImageIndex := zindex;  FBookMarksArray[zindex].BookmarkNumber := zindex;  FBookMarksArray[zindex].Column:= FETSynEdit.CaretX;  FBookMarksArray[zindex].Line := FETSynEdit.CaretY;  FBookMarksArray[zindex].Visible := True;  FETSynEdit.Marks.Add(FBookMarksArray[zindex]); //point(1)   if (zindex < FEtSynEdit.Marks.Count) and (FEtSynEdit.Marks[zindex].BookmarkNumber >= 0) then     information('ok') else information('not ok'); //point(2)You can also report undesirable behavior thios function under the specified commit. ---------------------------------------------------------------------- Martin_fr · 2025-11-05 07:48 It looks as if you now need to create a TSynEditBookMark instead. Not sure if the old way is going to be restored... (though I need to see what to do about "BookmarkNumber") Why don't you use SynEdit.SetBookmark ? ---------------------------------------------------------------------- scasparz · 2025-11-05 09:31 To begin with thanks both paweld and martin_fr for your quick replies. For the record, my app was initially written years ago on Laz v_0.9.x, but I keep maintaining it by adding new stuff. Originally this part of the code was written under Laz v_2.x and AFAIK it used to work well. Was surprised to find it does not under Laz 4 when I attempted to have it recompiled. @paweld indeed FETSynEdit.Marks.Count works in the sense that it gets increased by one after insert. Yet for some reason it looks that although the new bookmark gets into the Marks list (from what I can see on the debugger) still it cannot be intercepted resulting in all shorts of trouble at later stages of my application, rendering it completely useless. To put it simple, I depend upon IsBookmark. @martin_fr am glad to realise SynEdit is been reworked as indeed this is needed, under Linux I have a number of issues with the component for years. IMO perhaps the best approach would have been for us to be provided with the IDE version of the SynEdit that seemed to work very well instead of the tSynEdit we are given which am afraid leaves something to be desired. I understand this is not going to be easy. As for the SetBookMark method, I did not know of its existence and of course it’s syntax, that is before you had it mentioned, thank you for this. Unfortunately it is not unusual for open source to be provided with scarce documentation, sometimes I can live without it, others not. Following downgrade from Laz 4 to Laz 3, I cannot even find unit SynEdit using Ctrl-(left click) on the source window (Unable to find file "synedit.pp". If it belongs to your project, check search path in Project -> Compiler Options -> Search Paths -> Other Unit Files. etc). Perhaps something has gone wrong, I may have to try a clean installation of Laz 3 before I try again. All this despite that app can be compiled and run sans issues. thanks again guys s ---------------------------------------------------------------------- paweld · 2025-11-05 09:59 Quote from: scasparzYet for some reason it looks that although the new bookmark gets into the Marks list (from what I can see on the debugger) still it cannot be intercepted resulting in all shorts of trouble at later stages of my application, rendering it completely useless. To put it simple, I depend upon IsBookmark. As @Martin_fr said - use TSynEditBookMark: 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 {var  FBookMarksArray: Array of TSynEditBookMark; begin}  IF FEtSynEdit.IsBookmark(zindex)    THEN FEtSynEdit.ClearBookMark(zindex);   FBookMarksArray[zindex] := TSynEditBookMark.Create(FETSynEdit);  //change array definition too  FBookMarksArray[zindex].ImageList := FBookMarksImageList;  FBookMarksArray[zindex].ImageIndex := zindex;  FBookMarksArray[zindex].BookmarkNumber := zindex;  FBookMarksArray[zindex].Column:= FETSynEdit.CaretX;  FBookMarksArray[zindex].Line := FETSynEdit.CaretY;  FBookMarksArray[zindex].Visible := True;  FETSynEdit.Marks.Add(FBookMarksArray[zindex]); //point(1)   if FEtSynEdit.IsBookmark(zindex) then information('ok') else information('not ok'); //point(2) ---------------------------------------------------------------------- scasparz · 2025-11-05 17:42 Problem with Laz 4 is the 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 IF FEtSynEdit.IsBookmark(zindex)    THEN FEtSynEdit.ClearBookMark(zindex);  returns false, independent of whether the bookmark has been set or not. Me thinks this is a bug with Laz4. best regards c ---------------------------------------------------------------------- paweld · 2025-11-05 17:54 Sow more code. I checked it on simple code, and if you add it as TSynEditBookMark (not TSynEditMark), then the IsBookmark function returns True. ---------------------------------------------------------------------- Martin_fr · 2025-11-06 08:14 Quote from: scasparz on November 05, 2025, 10:31:54 am@martin_fr am glad to realise SynEdit is been reworked as indeed this is needed, under Linux I have a number of issues with the component for years. IMO perhaps the best approach would have been for us to be provided with the IDE version of the SynEdit that seemed to work very well instead of the tSynEdit we are given which am afraid leaves something to be desired. I understand this is not going to be easy. I don't know which version/fork of SynEdit you have. But there are a few of them out there. The one shipped with the IDE was forked around the year 2000. And has since (or at least from 2008 onwards) received massive changes. It's internal structure is now much different from the original. If you do still have any of the issues, when using the SynEdit that comes with the IDE, then please let me know. One known (Linux) issue is display of Arabic text (and some other languages). This is due to how the Windows API is emulated by the LCL. Letters are printed on their own, but in Arabic scripts their look depends on the surrounding letters (which then are not considered). QuoteAs for the SetBookMark method, I did not know of its existence and of course it’s syntax, that is before you had it mentioned, thank you for this. Unfortunately it is not unusual for open source to be provided with scarce documentation, sometimes I can live without it, others not. Following downgrade from Laz 4 to Laz 3, I cannot even find unit SynEdit using Ctrl-(left click) on the source window (Unable to find file "synedit.pp". If it belongs to your project, check search path in Project -> Compiler Options -> Search Paths -> Other Unit Files. etc). Perhaps something has gone wrong, I may have to try a clean installation of Laz 3 before I try again. All this despite that app can be compiled and run sans issues. IIRC, I probably assumed "SynEdit.Marks" to be an internal details, at least for bookmarks. Of course, in the end its public, so.... Hence it isn't even listed as incompatible change. I will have to work on it, since now the old marks (which no longer can be bookmarks) have still a bookmarknumber. Not sure yet, how I will resolve it. ---------------------------------------------------------------------- Martin_fr · 2025-11-06 10:15 OK, this should restore the old behaviour (hopefully) https://gitlab.c om/freepascal.org/lazarus/lazarus/- /commit/cfb8e043815b3e02666b01cf3f63c070a1532799 Could you please test it? ---------------------------------------------------------------------- scasparz · 2025-11-06 22:22 @Martin_fr QuoteOK, this should restore the old behaviour (hopefully) https://git lab.com/freepascal.org/lazarus/lazarus/- /commit/cfb8e043815b3e02666b01cf3f63c070a1532799 Will definitely try this, but will have to uninstall Laz3 I use at the moment and reinstall Laz4 once more. At this time I actively develop my app under Laz3, cannot switch to Laz4 easily. Please give me some time. I plan to use a virtual machine for the purpose, install Laz4 on it, modify both units, rebuild Laz, transfer my app and try. But I will come back, promise. Please keep the link up. QuoteIf you do still have any of the issues, when using the SynEdit that comes with the IDE, then please let me know. One annoying issue I have since the beginning of time with tSynEdit under Linux has been that occasionally (unfortunately I cannot replicate the issue - I know it is embarrassing) when I enter a keystroke, it fails to alter the text on screen. Keystroke can be either a normal text letter, or a control character say . By conducting PgUp and PgDown the text appears this time as desired, nothing has been lost, it is just that the screen seems to not have been updated following the keyboard entry, of course clearly keyboard has not misfired. Thanks God this is not a frequent issue and if memory serves by undoing and repeating the keystroke again it works well this time. Have used Laz4 only briefly, cannot comment whether the issue is still present there. QuoteThe one shipped with the IDE was forked around the year 2000. And has since (or at least from 2008 onwards) received massive changes. It's internal structure is now much different from the original.If you were to give me the IDE version of the SynEdit as a number of units that I could use with my app, it would be a dream come true. Would be very glad to rewrite app from the scratch and buy you a beer. Just kidding, of course you deserve much more, thanks mate. kind regards s ---------------------------------------------------------------------- Martin_fr · 2025-11-07 08:05 You can either - patch your current installation - make a 2ndary install Under Windows the installer offers to set the 2ndary install up. Under Linux, you can use fpcupdeluxe. ---------------------------------------------------------------------- scasparz · 2025-11-07 08:10 Martin_fr, I could not compile Laz4 with the new versions of synedit.pp and syneditmarks.pp as I am missing unit LazEditTextAttributes and perhaps more (LazEditTextGridPainter). Where can I get them from? regards s ---------------------------------------------------------------------- Martin_fr · 2025-11-07 08:13 Quote when I enter a keystroke, it fails to alter the text on screen. That I don't know. Some people have issues with getting the key twice. Which is todo with some IMM manager under Linux. (Can be bypassed by using some env var IIRC, but I don't know the exact details. Its actually an LCL issue, and affects any custom written component that receives keystrokes (there should be an issue on the bug tracker). It is quite possible the issue you have is LCL too. - For TEdit and co, keys aren't handled by the LCL, as those are provided by the WS(gtk/qt) directly - For custom controls, keys are handled by the LCL QuoteIf you were to give me the IDE version of the SynEdit as a number of units that I could use with my app That is the version that is in lazarus/components/synedit. The same as you get when you use SynEdit from the component palette. The IDE also add the units /ide/sourcesyneditor and ide/sourceeditor. But the only add some functionality. ---------------------------------------------------------------------- Martin_fr · 2025-11-07 08:17 Quote from: scasparz on November 07, 2025, 09:10:03 amMartin_fr, I could not compile Laz4 with the new versions of synedit.pp and syneditmarks.pp as I am missing unit LazEditTextAttributes and perhaps more (LazEditTextGridPainter). Where can I get them from? components/lazedit https://gitlab.com/freepascal.org/lazarus/lazarus/- /tree/cfb8e043815b3e02666b01cf3f63c070a1532799/components/lazedit If you are replacing the entire SynEdit, rather than just applying the change as a patch, then you may need more changes from outside of SynEdit. Especially if you go git "main" branch. (The fix for bookmarks will be in upcoming Lazarus 4.4) ---------------------------------------------------------------------- scasparz · 2025-11-07 22:12 Martin, have copied entire contents of the link you provided into '/usr/share/lazarus/4.2.0/components/synedit' and attempted to build laz4 with profile normal IDE. This did not work. Have never used make or makefile before. Are they the key to recompile the modified synedit and where can I find information on how to use them here? regards s ---------------------------------------------------------------------- Martin_fr · 2025-11-07 22:33 Breaking this down: 1) Testing the fix for bookmark 2) Testing if any other changes in SynEdit are of interest to you 2 can be used for testing 1 too... 1) - Wait for Lazarus 4.4 (probably a week or so) / The fix will be in there - Start with Lazarus 4.0 or 4.2  and apply the patch  https://gitlab.c om/freepascal.org/lazarus/lazarus/- /commit/cfb8e043815b3e02666b01cf3f63c070a1532799.diff   Using the "patch" command line util. If memory serves Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i cd path/to/lazaruspatch < diff_file or maybe "patch -p1 < diff_file". If you are in the lazarus main dir, if you are in the Synedit dir it will probably be -p3 - Instead of applying the patch, edit the file by hand. - use fpcupdeluxe 2) You nee the git "main" branch, aka Lazarus 4.99. Since changes may also be in the LCL. For that use fpcupdeluxe. It can create an independent install, so your main install will not be altered. However, I am not an expert on fpcupdeluxe. There is a big thread on the forum, for getting help. FpcUpDeluxe allows to install any version, including "fixes-4" (which is the preparation for Laz4.4 and then will be prep for 4.6), and "main" aka 4.99 or trunk. FpcUpDeluxe  can install several Lazarus versions in different folders, and those use diff configs, and all. So they all work independently. Downloading SynEdit independent of the IDE, will be a lot of work, and may even not work at all. Since each version of SynEdit requires the correct LCL, LCLBase, LazUtils, etc. In some cases those may be compatible, but there is no rule when they are and when not. ---------------------------------------------------------------------- scasparz · 2025-11-08 09:05 Thanks again Martin. Seems waiting form Laz 4.4 to be the easiest way and I will come back. kind regards s ---------------------------------------------------------------------- scasparz · 2025-11-11 07:21 @martin_fr. Have just installed Laz4.4 and in the first test the IsBookmark method worked well. Intend to test further. Will update in case of new findings. Thanks again Martin. best regards s ---------------------------------------------------------------------- scasparz · 2025-11-13 10:30 @martin_fr Made a new clean installation of Laz 4.4 under Linux Mint 21.1 Further tests have shown no problems. Looks like app works as it should under the latest Laz . Good job Martin, thanks again mate. best regards s ---------------------------------------------------------------------- Martin_fr · 2025-11-15 12:49 FYI: Other upcoming SynEdit changes https://gitlab.com/freepascal.org/ lazarus/lazarus/-/issues/41873#note_2890879142