[Lazarus] Making tabs smart

Juha Manninen (gmail) juha.manninen62 at gmail.com
Fri Oct 22 14:31:42 CEST 2010


On Wednesday 20 October 2010 15:52:22 Martin wrote:
>    if Accept then
>    begin
> 
> 1 2    3    4   5
> 
> 
> 1 begin of line
> 2 first word "begin"
> 3 end of line
> 4 next word, but 2 lines above (first line long enough)
> 5 end of line but 2 lines above

I get the feeling of stupid tabs, too, sometimes.
The most obvious location is missing. That is between "2" and "3", the 
indented code after "begin". Usually the codetools-based autoindent takes care 
of it when you press Enter, but not always.
To make the tab smarted it could ask for info from codetools about good 
indentation spots.

Another improvement would be to inspect the surrounding code instead of just 
preceding code. For example if I want to align comments:

  s1 := MyFunc1();                 // Comment at the column I want it to be.
  s2 := MyFunc2();|  <-- cursor

Now the tab is smart, good.
But if I have:

  s1 := MyFunc1();|  <-- cursor
  s2 := MyFunc2();                 // Comment at the column I want it to be.

The tab became stupid again.

This smart tab feature could be integrated with codetools indentation feature 
somehow.
There is an issue of the GUI settings being on different pages. Maybe it 
indicates that the design is not perfect either.

Juha




More information about the Lazarus mailing list