[Lazarus] THelpEvent declaration discussion
Graeme Geldenhuys
graeme at mastermaths.co.za
Thu Nov 5 13:36:55 CET 2009
Hans-Peter Diettrich wrote:
>
> What will happen when you commit your changes? Will everybody have to
> work with your formatting, casted into spaces?
With mono fonts it will look at the surrounding text and add enough
spaces to keep the aligned text in the same position. Please note that
such conversions (tabs to spaces) are user selectable and is only a
stop-gap (work-around) for people not using elastic tabstops.
To get the full benefit of elastic tabstops, you would switch your
projects to using tabs instead of spaces. I would definitely switch my
projects to using tabs instead of spaces. Elastic Tabstop formating
would then correct the alignment of text for each developer in my team.
> I'd agree with different tabstop codes, so that the formatting can be
> undone or suppressed at any time.
Code formatting has always been a screw-up, and no idea is a perfect
one, that even applies to spaces. I simply think Elastic Tabstops is a
point in the right direction and solves more formatting problems that it
causes. Compare that to other methods...
As for examples of screwed-up formatting... Just look at Lazarus and FPC
code.
We have hundreds of variations as follows:
---------------------
procedure Myproc;
vs
procedure Myproc ;
---------------------
procedure Myproc;
var
i: string;
begin
...
vs
procedure Myproc;
var
i: string;
begin
...
---------------------
Or the old favourite...
if a=b then begin
...
vs
if a = b then
begin
...
---------------------
> Automatic formatting has to know about the language, in order to know
> where to indent and outdent blocks, or how to build columns of other
> items.
No it as nothing to do with the language... as my Object Pascal examples
above shows. Every developer seems to have there own idea of what code
formatting looks correct. Even if they all program in the same language.
>
>
>>> If somebody wants to have formatted tables, he'll have to insert
>>> formatting *instructions*, so that the layout can be restored
>>> later - but where should such instructions be stored?
>> This has been done for years in C programming. Have you not noticed
>> the first line in many C source code files, it specifies the tab
>> width in a commented line.
>
> I never saw that, but what's the use of such indicators?
The customization lines seen in a C source code using the vim editor...
-------------------------
/* vim: set autoindent: */
/* vim: set tabstop=2: */
...
-------------------------
And Mozilla C source code...
--------------------------
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4
-*- */
/* ex: set tabstop=8 softtabstop=4 shiftwidth=4 expandtab: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
...
---------------------------
And even some PHP source code
-------------------------------------
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
//
...
-------------------------------------
For millions more examples, use the Google Source Code Search tool.
http://www.google.com/codesearch?hl=en
Did you know you can even find Lazarus source code on Google. :-)
http://www.google.com/codesearch?hl=en&q=fpgui
> This only applies to tabs at the begin of a line, where formatting
> also can be done automatically.
No, this applies to tabs anywhere in your code.
>> If you are still confused as to what Elastic Tabstops do, then
>> re-read my earlier post that explains it.
>
> Sorry, it doesn't explain much. It shows how the output could look
> like, if everything works.
I can see you don't understand how elastic tabstops work. Neither did I
at first. No problem, maybe the original website might explain it
better, including the java applet editor which has elastic tabstops
support. Also view the gEdit screencast.
http://nickgravgaard.com/elastictabstops/
Regards,
- Graeme -
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/
More information about the Lazarus
mailing list