[fpc-pascal] Underscores in numerical literals - grouping

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Tue Nov 22 13:41:37 CET 2016

On 2016-11-22 11:15, Jürgen Hestermann wrote:
> I am still not sure how exactly elastic tab stops work.

Think how a word processor (MS Word, LibreOffice Writer) interprets
tabstops. Word Processors don't define a TAB as x width of Spaces or
Pixels. But for some strange reason IDE's and Text Editors do!

In word processors a single TAB character can jump the cursor all the
way to the right side of a page. Also you can have multiple tabstops on
a single line, but each tabstop has a different width.

That is kind-of how Elastic Tabstops work, but in the case of ET, it
decides the width of a tabstop based on a block of text and your
Indentation and Padding preferences.

> What if an empty line is between such lines?

ET works with text blocks, so an empty line would introduce the start of
a new text block. The new text block might still fall under a previous
indentation level though. I guess the best way to understand this is to
try out the small Java application downloadable from the author's homepage.

> In this example (where 'Param1' should align with 'Param2')

If you want something aligned or at the same indentation level, you
simply need to insert a TAB character. ET will keep blocks of text
indentation and aligned even if any text inside that block grows or shrinks.

I wrote your sample code in two ways. The first sample doesn't really
take much advantage of ET, as all tab widths are the same (indentation).
I enabled showing TAB characters so you can better see what I mean.

In the second layout example (lines 13-21) you will note that on line 15
the second tab is considerably larger than all other tabs. ET did that
because the two parameters of FunctionA() fall into the same text block,
so they get aligned equally.

Then for good measure, I loaded that same sample text into my
experimental ET enabled editor and switched to a proportional font
(Input Sans). Magically all indention and alignments are still correct.
:-) That will still be true even for other wacky proportional fonts like
cursive ones or MS Comic Sans etc.

> I found an interesting discussion discussion about elastic tabstops with some cons here:
> http://softwareengineering.stackexchange.com/questions/137290/what-are-the-drawbacks-of-elastic-tabstops

hahaha... I love how a con is “fundamentally different concept”. How is
that a con? Just because ET's implementation is different to how TABs
were handled in text editors for the last couple of decades, doesn’t
constitute it as a con - it’s an improvement to how TABs are interpreted
and rendered on screen.


fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

My public PGP key:  http://tinyurl.com/graeme-pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sample-1_monospaced_font.png
Type: image/png
Size: 7673 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20161122/59035755/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sample-2_proportional_font.png
Type: image/png
Size: 10401 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20161122/59035755/attachment-0001.png>

More information about the fpc-pascal mailing list