Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-11

CodeTools never uses Tab character settings from editor preferences

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I searched Manis but couldn't find any existing reports - though searching Mantis a normaly a shot in the dark too.

Is it a known problem that CodeTools doesn't adhere to the editor settings? For some of my projects I now use Tab characters for indentation. Lazarus Trunk has finally fixed the Block Indentation bug
- now it can use tab characters too.

Anyway, there are still plenty of cases in Lazarus IDE where code is generated by the IDE, but spaces are used for indentation, instead of my editor preference Tabs.

My editor settings are as follows:
tab to space: unticked
tab width: 6
smart tabs: unticked
Auto indent: ticked
tab indents blocks: ticked
block indent (spaces): 0
block indent (tabs): 1

Examples of problem cases:

1) Create a new project. The Unit1.pas file uses spaces for indentation in the newly created file. This applies to the project source file too (the one that contains the program declaration.

2) Create a new LCL project, drop components on the form.
- indentation is wrong
- indentation uses spaces, and not my editor preference of tab characters.

3) Code Templates. eg: tryf [then press Ctrl+j] indentation uses spaces.
I did find a old bug report about this, but in the latest Trunk revision it is broken.
http://bugs.freepascal.org/view.php?id=17632
see attached image.

4) Letting the IDE create event handlers. The event handler declaration is wrongly indented.

.... there are a few more, but I think you get the picture.

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net -------------- next part -------------- A non-text attachment was scrubbed... Name: code_template_indentation.png Type: image/png Size: 4014 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111116/391b45a2/attachment.png>

Reply by email

Martin
to Graeme Geldenhuys
Graeme Geldenhuys wrote
4) Letting the IDE create event handlers. The event handler declaration is wrongly indented.

I can't comment on most of the codetool issues you describe, but a question this last one:

Is this the same as creating a procedure via class completion? And (with your settings) are spaces actually inserted at that time or is the caret only positioned (can be forced even if "past end of line" is off)

if position only: correct indent?

Reply by email

Graeme Geldenhuys
to Martin
Martin wrote
> I can't comment on most of the codetool issues you describe, but a question this last one:

This is what I meant by that last one. Two problems of indentation.

- Indentation in the class definition is wrong. Normally the Button1 and procedure Button1Click() declarations would be indented one level from TForm1. In the case below, they are all on the same indent level.

- The cursor inside the Button1Click is placed at column 0 (where the | sign is). I believe it used to indented correctly when spaces are used instead of tab character indentation.

in all cases (for this example) indentation is done via spaces, and not the tab characters.

--------------------------------------------

type
  TForm1 = class(TForm)
  Button1: TButton;
  procedure Button1Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
begin
|
end;

--------------------------------------------

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net

Reply by email

Martin
to Graeme Geldenhuys
Graeme Geldenhuys wrote 14 lines
On 16/11/2011, Martin wrote: > I can't comment on most of the codetool issues you describe, but a > question this last one: This is what I meant by that last one. Two problems of indentation. - Indentation in the class definition is wrong. Normally the Button1 and procedure Button1Click() declarations would be indented one level from TForm1. In the case below, they are all on the same indent level. - The cursor inside the Button1Click is placed at column 0 (where the | sign is). I believe it used to indented correctly when spaces are used instead of tab character indentation.

Ah seems there are indeed a few other methods that use the setting for spaces. So yes they will have to learn about the new setting to make it fully useful.

Don't know how easy or not it will be, to do that for codetools...

Reply by email