[Lazarus] Is there a bug in auto indentation in 1.4 or is it just me?
Bernd
prof7bit at gmail.com
Thu Jul 9 09:21:03 CEST 2015
Ok, I have a working minimal example, see the attached file.
It seems to be related to the setting: "context sensitive"
In my above example I have two functions "foo" and "bar". The first
one is formatted like K+R-Style (begin on end of line), I have been
doing this with all my code since the early days already without
problems, the only times I am using traditional formatting is when I
am working on someone elses project with different formatting. The
second function uses the traditional Pascal formatting (begin on own
line).
* It only ever seems to affect the else branch of an if, no other
constructs I have found to be affected.
In the first function it will still work, it seems when it is trying
to figure out the formatting it is looking at the second function
(which is formattet like the standard pascal formatting). But as soon
as there is more than one else with K+R formatting in the file it will
stop working correctly.
* Even if my entire file is formatted strictly K+R it won't be able to
indent the else branch correctly anymore, but all other constructs
seem to work just fine with this formatting style.
* If I turn "context sensitive" OFF then all problems disappear (even
with mixed traditional and K+R formatting).
* If I use an entirely K+R formatted laz_indentation file it makes no
difference, it still always works (even for mixed sources).
* If context sensitive is ON it will stop working, regardless of the
formatting of the laz_indentation file, even if there is NO (!)
laz_indentation file at all, the else branch will always be broken in
K+R, all other constructs will be working fine.
Bernd
2015-07-08 15:22 GMT+02:00 Martin Frb <lazarus at mfriebe.de>:
> On 08/07/2015 10:51, Bernd wrote:
>>
>>
>> I cannot find any way to influence this behavior in the editor
>> settings (which are very confusing btw), I cannot even change anything
>> at all there, even if I set everything to 4 spaces instead of 2 it
>> will still use 2 spaces everywhere (and 4 in an else begin branch).
>>
>> Is this just me or is this a bug in the 1.4 release?
>>
>
> You probably have "smart indent" on (see codetools section of config). The
> editor section has a link that takes you there too.
>
> afaik the smart indent takes it rules from a sample source in the config
> path...
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Unit1.pas
Type: application/octet-stream
Size: 321 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20150709/4897ba61/attachment-0003.obj>
More information about the Lazarus
mailing list