Recent

Author Topic: Lazarus Release Candidate 2 of 4.0  (Read 25311 times)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10791
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus Release Candidate 2 of 4.0
« Reply #60 on: January 25, 2025, 09:12:26 am »
While my setup seems to allow for only four space indents, as I type the above, I type 'begin' and press Enter, the IDE adds a two space indent and the 'end;'. If there somewhere else I can set that indent to 4 rather than 2 I cannot find it.

I am not 100% sure, but the automatic adding of "end" is codetools, so you probably have smart indent on. (follow that link on the page, or go to "codetools > general"  options). Smart indent uses a sample file to determine what to do, which can be accessed via the codetool options.

Otherwise on the page of you image, check the drop down for "auto indent". You currently have it an "spaces", it should have some tab related settings. Either "as previous line" or "Tabs then..." (the then only to be applied if your previous line doesn't align with tabs.
=> Auto indent will only keep indent. It will not add new indent after begin (nor add the "end"). Those are codetools only.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10791
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus Release Candidate 2 of 4.0
« Reply #61 on: January 25, 2025, 10:29:24 am »
But I don't see any mention of LCProc.DebugLn() being deprecated in the Release Notes, should it be there ? It sure did generate a lot of warnings in my app.

Added.

dbannon

  • Hero Member
  • *****
  • Posts: 3212
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Lazarus Release Candidate 2 of 4.0
« Reply #62 on: January 25, 2025, 11:40:32 am »
... If there somewhere else I can set that indent to 4 rather than 2 I cannot find it.

... so you probably have smart indent on.
Apparently.  On the Code Tools page there are three tick boxes that seem to turn Smart Indent on. Unticking the "On break line" box does stop the two character indent, thats at least half a solution, you only have to press the tab key to be where you should be.

But it would be nicer to have the indent auto added, it should be possible to set it four spaces, all the other related settings work as expected.

Smart indent uses a sample file to determine what to do, which can be accessed via the codetool options.

I have heard that said, but never found it. Do you mean laz_indentation.pas in the config dir ?  What do you do, edit all the lines in there to what you want ? :-\

Otherwise on the page of you image, check the drop down for "auto indent". You currently have it an "spaces", it should have some tab related settings. Either "as previous line" or "Tabs then..." (the then only to be applied if your previous line doesn't align with tabs.
I just tried each option for "auto indent", even the ones I don't understand, none made any difference to what I am doing.

=> Auto indent will only keep indent. It will not add new indent after begin (nor add the "end"). Those are codetools only.

Yep, I understand that. My tests start with already indented text above, 4 spaces. The cursor ends up at pos 7 in very case.

Sorry to drag this out Martin. Its a very minor issue but annoys me. Just turning Smart Indent off is, to some degree, a solution. But not a perfect one.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10791
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus Release Candidate 2 of 4.0
« Reply #63 on: January 25, 2025, 12:34:17 pm »
Maybe this should go to another thread...

Smart indent uses a sample file to determine what to do, which can be accessed via the codetool options.

I have heard that said, but never found it. Do you mean laz_indentation.pas in the config dir ?  What do you do, edit all the lines in there to what you want ? :-\
Yes, and that is all I know. The only one that I know who would know is Mattias.

All the settings under "Editor>Indent" (where you can directly select spaces and numbers) are only for the "non-codetools" operation. The simple mechanical indent. But that does not recognize context (like the begin in the line above) and therefore does not add extra indent after such a begin. It just keeps existing indent.

Working based on code, is codetools.


Quote
Otherwise on the page of you image, check the drop down for "auto indent". You currently have it an "spaces", it should have some tab related settings. Either "as previous line" or "Tabs then..." (the then only to be applied if your previous line doesn't align with tabs.
I just tried each option for "auto indent", even the ones I don't understand, none made any difference to what I am doing.

=> Auto indent will only keep indent. It will not add new indent after begin (nor add the "end"). Those are codetools only.

Yep, I understand that. My tests start with already indented text above, 4 spaces. The cursor ends up at pos 7 in very case.

Sorry to drag this out Martin. Its a very minor issue but annoys me. Just turning Smart Indent off is, to some degree, a solution. But not a perfect one.

You want the indent done by
- 1 or more tab(s) that is/are each 4 spaces wide
- groups of 4 spaces
?

The only way I know to configure it (but I never tried the codetools way) is to turn of the codetools indent. (there may or may not be a way / I have no clue)


For tabs
Set
- "tabs to spaces": OFF
- the "Auto indent" to either "tabs then spaces" or "tabs then cut".

For spaces
Set
- "tabs to spaces": ON
- the "Auto indent" to either "spaces".



Block indent is when you have a selection and press tab.

Smart tabs, finds gaps in the line above, and aligns with them (not just at the start of line but inside the line)
Keep smart tabs off until all else works

TRon

  • Hero Member
  • *****
  • Posts: 3930
Re: Lazarus Release Candidate 2 of 4.0
« Reply #64 on: January 25, 2025, 11:22:55 pm »
Following probably does not belong in this thread (it isn't exactly a bug or regression) but don't know of a better place as it ain't worth a dedicated thread. If not already done so is there any planning on adding the component palette being visible or not to the desktop settings ? It seems to be the only visual thing left that requires its own on/off setting.
I do not have to remember anything anymore thanks to total-recall.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10791
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus Release Candidate 2 of 4.0
« Reply #65 on: January 25, 2025, 11:47:34 pm »
Following probably does not belong in this thread (it isn't exactly a bug or regression) but don't know of a better place as it ain't worth a dedicated thread. If not already done so is there any planning on adding the component palette being visible or not to the desktop settings ? It seems to be the only visual thing left that requires its own on/off setting.

If that is so (I don't use desktop settings) then best to report a feature request. At least it will be known.

baldzhang

  • New Member
  • *
  • Posts: 44
Re: Lazarus Release Candidate 2 of 4.0
« Reply #66 on: January 26, 2025, 02:52:51 am »
I've seen that on xfce only, cca every second showing it is shown in taskbar on x11 xfwm4. You can open issue so it won't be forgotten, I'll try to fix it before 4.0 is out.

create issue report, it's not for the hint window. I feel it's related:
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41361

and found some code in qt5/qt6 that check window-manager is 'xfwm4', is it useful if just comment this out?
UPDATE: tested comment this codes, not effective at all.
« Last Edit: January 26, 2025, 03:01:40 am by baldzhang »

n7800

  • Full Member
  • ***
  • Posts: 235
Re: Lazarus Release Candidate 2 of 4.0
« Reply #67 on: January 26, 2025, 11:11:15 am »
Following probably does not belong in this thread (it isn't exactly a bug or regression) but don't know of a better place as it ain't worth a dedicated thread. If not already done so is there any planning on adding the component palette being visible or not to the desktop settings ? It seems to be the only visual thing left that requires its own on/off setting.

This setting is already part of the desktop.

I write MR for desktops, and I have several for testing. When switching between them, the component palette is shown/hidden, depending on the settings of the given desktop. This applies to the editor toolbars and other options (see issue #29742 for details).

There is only a bug that the active desktop is not saved (even with the autosave flag checked) when switching to another desktop - you have to close the IDE to save. I will find time and publish a patch later.

cpicanco

  • Hero Member
  • *****
  • Posts: 659
  • Behavioral Scientist and Programmer
    • Portfolio
Re: Lazarus Release Candidate 2 of 4.0
« Reply #68 on: January 26, 2025, 09:46:26 pm »
Hi everyone, great release, congratulations! I have a project that compiles just fine in trunk, but does not compiles in RC2 due to some FPC trunk and FPC 3.2.2 differences. May I ask if should I report them for future updates?  Please, take a look:

1) In Generics.Default, FPC trunk uses const (instead of constref) in TComparer.Compare:

Code: Pascal  [Select][+][-]
  1.   TComparer<T> = class(TInterfacedObject, IComparer<T>)
  2.   public
  3.     class function Default: IComparer<T>; static;
  4.     function Compare(constref ALeft, ARight: T): Integer; virtual; abstract; overload;
  5.  
  6.     class function Construct(const AComparison: TOnComparison<T>): IComparer<T>; overload;
  7.     class function Construct(const AComparison: TComparisonFunc<T>): IComparer<T>; overload;
  8.   end;  

2) FPC 3.2.2 do not propagate String helpers for ShortString's. Hence:

Code: Pascal  [Select][+][-]
  1. // one may change this
  2. TObject.ClassName.Replace('T', '');
  3.  
  4. // to this
  5. String(TObject.ClassName).Replace('T', '');

3) I am getting an internal error 200510032, and also "Undefined symbol: .Lj2139" when trying to use .ToInteger helper with a specialized TDictionary:

Code: Pascal  [Select][+][-]
  1. program rc2test;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}
  7.   cthreads,
  8.   {$ENDIF}
  9.   Classes,
  10.   SysUtils,
  11.   Generics.Collections;
  12.  
  13.   procedure DoIt;
  14.   type
  15.     TMyDictionary = specialize TDictionary<string, string>;
  16.  
  17.   var
  18.     MyDictionary : TMyDictionary;
  19.  
  20.   begin
  21.     MyDictionary := TMyDictionary.Create;
  22.     try
  23.        MyDictionary.Add('Key', '1');
  24.        WriteLn(MyDictionary['Key'].ToInteger);
  25.     finally
  26.        MyDictionary.Free;
  27.     end;
  28.   end;
  29.  
  30. begin
  31.   DoIt;
  32.   ReadLn;
  33. end.

I manage to compile doing some refactoring.

4) TEvent.Create, from syncobjs unit is not overloaded in FPC 3.2.2, so one must create it explicitly. FPC 3.3.1 will call "BasicEventCreate(nil, True,False,'')" when using the overloaded constructor.
« Last Edit: January 26, 2025, 10:30:48 pm by cpicanco »
Be mindful and excellent with each other.
https://github.com/cpicanco/

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10791
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus Release Candidate 2 of 4.0
« Reply #69 on: January 26, 2025, 10:17:59 pm »
Hi everyone, great release, congratulations! I have a project that compiles just fine in trunk, but does not compiles in RC2 due to some FPC trunk and FPC 3.2.2 differences. May I ask if should I report them for future updates?  Please, take a look:

If your code needs FPC trunk then it does (and will) not work in any released Lazarus (except if you combine such a release with FPC trunk yourself).

I would expect you get the same error in Lazarus 3.6 and 3.8? (maybe except the undefined label, but that is still an fpc issue).

The release will only be build with the released fpc 3.2.2.
(And when fpc 3.2.4 comes out, then an update will be released / but I do not know the fpc schedule on that).


You can of course test the 4.0RC with fpc trunk. (if your fpc trunk install is recent enough).
If that gives errors, then it has to be established if this is an issue in fpc trunk (since bugs come and go in trunk), or if it is in Lazarus. The latter will likely be addressed (if the fpc team confirms that the change in the compiler is by design).

Quote
In Generics.Default, FPC trunk uses const (instead of constref) in TComparer.Compare:
If that prevent any code that is part of Lazarus (IDE, LCL, components, ...) from compiling (e.g. due to inheritance failing) then we will likely fix our code with relevant IFDEF so it can be compiled with trunk.

In general we aim for any code that we ship to compile with
- the current fpc release (as of now 3.2.2)
- the previous fpc release (as of now 3.2.0)
- fpc fixes branch (only the most recent commit) / if it fails, first update
- fpc trunk branch (only the most recent commit) / if it fails, first update
Of course for the 2 branches, only if compiler errors are not caused by bugs in that fpc revision.

Quote
FPC 3.2.2 do not propagate String helpers for ShortString's.
That would likely only affect your code? So then, nothing we can do. If you need that you need to install FPC trunk yourself.  It should not require changes in Lazarus.

Quote
I am getting an internal error 200510032, and also "Undefined symbol: .Lj2139"
Definitely a bug in fpc.

It might be that Lazarus 3.6 or 3.8 did not trigger this. But unfortunately we don't know what triggers this fpc bug. So we can't add any work around for it.
(if that bug is triggered for your code by changes in Lazarus between V3 and V4)

cpicanco

  • Hero Member
  • *****
  • Posts: 659
  • Behavioral Scientist and Programmer
    • Portfolio
Re: Lazarus Release Candidate 2 of 4.0
« Reply #70 on: January 26, 2025, 10:53:59 pm »
Thank you for the information Martin. I edited the post, I managed to compile doing some refactoring. So, I really think that those points are not related to Lazarus at all (although I expect that many bugs could be avoided by incorporating them in FPC 3.2.2, I am not sure if it would be possible, can you confirm?). Everything is working just fine here now! Great work!

Code: Pascal  [Select][+][-]
  1. var
  2.   s1 : string;
  3.  
  4. begin
  5.   s1 := MyDictionary['Numeric'];
  6.   WriteLn(s1.ToInteger);
  7. end;
Be mindful and excellent with each other.
https://github.com/cpicanco/

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10791
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus Release Candidate 2 of 4.0
« Reply #71 on: January 26, 2025, 11:44:35 pm »
Thank you for the information Martin. I edited the post, I managed to compile doing some refactoring. So, I really think that those points are not related to Lazarus at all (although I expect that many bugs could be avoided by incorporating them in FPC 3.2.2, I am not sure if it would be possible, can you confirm?). Everything is working just fine here now! Great work!

I am not part of the FPC team, so limited means of answering this. You likely mean 2.2.4 though => 3.2.2 is released (and has been for a while), so that isn't changing.

Afaik/by design 3.2.4 is bug fixes. So it depends what is seen as bugfix and what is seen as feature.
I guess:
- string helpers => normally feature
- The internal error, and label not found => bug => if it is not yet in 3.2.4RC-branch then its (most likely) a matter of finding the commit in 3.3.1 that fixed it.
- constref => could be either, depends why it was changed.

But I have seen, you ask that on the fpc thread. So hopefully someone from the fpc team can give a better answer.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10791
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus Release Candidate 2 of 4.0
« Reply #72 on: January 26, 2025, 11:46:11 pm »
The string helper, you could always copy that code from fpc, into a unit of yours, and use that unit, until fpc release it. (just copy/respect the license header)

TRon

  • Hero Member
  • *****
  • Posts: 3930
Re: Lazarus Release Candidate 2 of 4.0
« Reply #73 on: January 27, 2025, 01:01:35 am »
Following probably does not belong in this thread (it isn't exactly a bug or regression) but don't know of a better place as it ain't worth a dedicated thread. If not already done so is there any planning on adding the component palette being visible or not to the desktop settings ? It seems to be the only visual thing left that requires its own on/off setting.
If that is so (I don't use desktop settings) then best to report a feature request. At least it will be known.
Thank you for the suggestion Martin_fr.

This setting is already part of the desktop.

I write MR for desktops, and I have several for testing. When switching between them, the component palette is shown/hidden, depending on the settings of the given desktop. This applies to the editor toolbars and other options (see issue #29742 for details).

There is only a bug that the active desktop is not saved (even with the autosave flag checked) when switching to another desktop - you have to close the IDE to save. I will find time and publish a patch later.
Ok, thank you for letting us know.

My only concern was if this is/was on the radar and apparently it is which is good enough for me, thank you for working on it n7800.

Also nice of you to mention coolbar as well because that was the other one that seem to be left (but isn't as bothersome as the component palette in case configuring as a source-code editor only).

Reason to mention is that I can see the shift for the options in 4.0RC2 but those 2 seem to have been left out (but I did not check recent trunk yet). In 4.0RC2 release things becomes messy when in docked IDE mode and turning on/off the component palette when you only have the source-code editor visible (linux/gtk2).
« Last Edit: January 27, 2025, 01:04:59 am by TRon »
I do not have to remember anything anymore thanks to total-recall.

baldzhang

  • New Member
  • *
  • Posts: 44
Re: Lazarus Release Candidate 2 of 4.0
« Reply #74 on: January 27, 2025, 04:52:55 pm »
I've seen that on xfce only, cca every second showing it is shown in taskbar on x11 xfwm4. You can open issue so it won't be forgotten, I'll try to fix it before 4.0 is out.

issue opened: https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41370

 

TinyPortal © 2005-2018