[Lazarus] New refactoring idea: extract constant

Alexander Klenin klenin at gmail.com
Wed Nov 4 02:09:17 CET 2009


Graeme Geldenhuys wrote:
> By the way, do you know if it is possible to implement the feature
> request #9650 in Lazarus IDE yet? At the time of the feature request,
> SynEdit did not have the capability to set variable length tabstops
> (tabstops based on varying pixel widths) per line. SynEdit could only
> set tab stops per complete file and were character based if I remember
> correctly - every line has the same tab stop points.
>
>   http://bugs.freepascal.org/view.php?id=9650
>
> I remember trying out the Java demo editor using Elastic Tabstops and
> write some Object Pascal code with comments aligned on the right of
> code etc. Elastic TabStops worked very nicely. And when saved, tabs
> are removed and spaces inserted - so other developers using a
> different editor or not using Elastic Tabstops feature will not be
> hassled.
>
>
> The following site explain benefits of Elastic Tabstops and bust some myths:
>    http://tibleiz.net/code-browser/elastic-tabstops.htm
Yes it is possible, and yes it should be very easy to do so.
With one exception: Any form of auto Indent will not work with it yet

The calculation of tabs is done entirely (with the exception of auto 
indent) in the unit SynEditTextTabExpander

The unit can set the "width" (amount of spaces covered by) each tab 
individually.

If you subclass it, and then do the calculation inside (and add 
callbacks to tell synedit, that lines must be repainted), then it should 
work out of the box


Martin




More information about the Lazarus mailing list