<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE TIP SYSTEM "http://www.tcl.tk/cgi-bin/tct/tip/tipxml.dtd">
<!-- Converted at Mon May 20 11:30:51 GMT 2013 -->
<!-- TIP AutoGenerator - written by Donal K. Fellows -->

<TIP number='256'>
<header><title>Implement Tabular and Wordprocessor Style Tabbing</title><author address="mailto:vince@santafe.edu">Vince Darley</author><author address="mailto:vincentdarley@users.sourceforge.net">Vince Darley</author><status type='project' state='final' tclversion="8.5" vote='after'>$Revision: 1.15 $</status><history></history><created day='12' month='aug' year='2005' /></header>
<abstract>There are two common style of tabbing in the computer world: that used for a regular table of information, and that used by a word-processor/text editor. This TIP proposes to add support for the latter to Tk&apos;s <emph style="bold">text</emph> widget.</abstract>
<body><section title="Overview">
<para>Tk&apos;s <emph style="bold">text</emph> widget has historically only supported a <emph style="italic">tabular</emph> style of tabbing, where the n&apos;th tab character is associated explicitly with the n&apos;th tab stop (irrespective of whether that stop is to the left or right of the current x-position - if that stop is to the left then a single space is inserted as a fallback). A <emph style="italic">wordprocessor</emph> (or typewriter) has a different style in which a tab character is associated with the next tab stop to the right of the current x-position.</para>
<para>This TIP proposes to add wordprocessor-style tabbing to Tk&apos;s <emph style="bold">text</emph> widget.</para>
<para>Tk 8.4 only supports tabular tabbing (except for the special <emph style="italic">-tabs {}</emph> case, which uses wordprocessor style 8-tabs!), although none of this is clearly documented at all. Tk 8.5 at present actually only supports wordprocessor style tabbing (and fixed a bunch of other bugs present in Tk 8.4&apos;s tab handling). This behaviour change was an inadvertent result of fixing bugs in the code without the correct behaviour being very clearly specified. Hence this TIP will restore the old behaviour (minus bugs) as the default, and add the option of the new wordprocessor style behaviour.</para>
</section>
<section title="Proposal">
<para>A new <emph style="bold">-tabstyle</emph> configuration option will be added to the <emph style="bold">text</emph> widget, taking the values <emph style="bold">wordprocessor</emph> or <emph style="bold">tabular</emph> to specify the style of tabbing. The same option will also be added to <emph style="bold">tags</emph> in the text widget (which, as usual, will also allow an empty value for the configuration option). The default style of tabbing will be <emph style="bold">tabular</emph> for compatibility with Tk 8.4. Neither style name may be abbreviated.</para>
<para>As a result of this change, abbreviations such as <emph style="bold">-ta</emph> or <emph style="bold">-tab</emph> will become ambiguous and trigger an error. This is considered a bug in the calling script (and a trivial thing to fix in such scripts). Similar ambiguities have been introduced by TIPs in the past (e.g. with <emph style="italic">grid</emph>). It may actually be a useful ambiguity, in that it will alert script writers to the fact that new tabbing functionality is available, and in particular that a decision on desired tab style needs to be made.</para>
<para>In addition the strange difference in Tk 8.4 between an empty <emph style="bold">-tabs</emph> value and any other value will be changed for Tk 8.5 - it will use the <emph style="bold">-tabstyle</emph> option to determine how to interpret tabs under all circumstances, and use the <emph style="bold">-tabs</emph> list simply to determine the location of the tab stops.</para>
<para>Here&apos;s an example usage:</para>
<verbatim><vline encoding='base64'>cGFjayBbdGV4dCAudF0=</vline><vline encoding='base64'>LnQgY29uZmlndXJlIC10YWJzIHswLjVpIDEuMGkgMS41aSAyLjBpIDIuNWkgMy4waSAzLjVpIDQuMGkgNC41aX0=</vline><vline encoding='base64'>LnQgaW5zZXJ0IGVuZCAiYVx0Ylx0Y1x0YXNkYmNhbmFzZGFzZFx0ZVx0Zlx0Z1xuIg==</vline><vline encoding='base64'>LnQgaW5zZXJ0IGVuZCAiYVx0Ylx0Y1x0YXNkYmNhbmFzZGFzZFx0ZVx0Zlx0Z1xuIg==</vline><vline encoding='base64'>LnQgaW5zZXJ0IGVuZCAiYVx0Ylx0Y1x0YXNkYmNhbmFzZGFzZFx0ZVx0Zlx0Z1xuIg==</vline><vline encoding='base64'>LnQgaW5zZXJ0IGVuZCAiYVx0Ylx0Y1x0YXNkYmNhbmFzZGFzZFx0ZVx0Zlx0Z1xuIg==</vline><vline encoding='base64'>LnQgaW5zZXJ0IGVuZCAiYVx0Ylx0Y1x0YXNkYmNhbmFzZGFzZFx0ZVx0Zlx0Z1xuIg==</vline><vline encoding='base64'>LnQgaW5zZXJ0IGVuZCAiYVx0Ylx0Y1x0YXNkYmNhbmFzZGFzZFx0ZVx0Zlx0Z1xuIg==</vline><vline encoding='base64'>LnQgaW5zZXJ0IGVuZCAiYVx0Ylx0Y1x0YXNkYmNhbmFzZGFzZFx0ZVx0Zlx0Z1xuIg==</vline><vline encoding='base64'>LnQgdGFnIGNvbmZpZ3VyZSB3b3JkcHJvY2Vzc29yIC10YWJzdHlsZSB3b3JkcHJvY2Vzc29y</vline><vline encoding='base64'>LnQgdGFnIGFkZCB3b3JkcHJvY2Vzc29yIDMuMCA1LjA=</vline><vline encoding='base64'>LnQgdGFnIGNvbmZpZ3VyZSB0YWJ1bGFyIC10YWJzdHlsZSB0YWJ1bGFy</vline><vline encoding='base64'>LnQgdGFnIGFkZCB0YWJ1bGFyIDUuMCA3LjA=</vline></verbatim>
<para>and here&apos;s an example showing how Tk 8.4 does <emph style="italic">not</emph> move you to the next tab stop to the right each time:</para>
<verbatim><vline encoding='base64'>cGFjayBbdGV4dCAudF0=</vline><vline encoding='base64'>LnQgY29uZmlndXJlIC10YWJzIHswLjI1aX0=</vline><vline encoding='base64'>LnQgaW5zZXJ0IGVuZCAiW3N0cmluZyByZXBlYXQgYSAyMF1bc3RyaW5nIHJlcGVhdCBcdGIgMTBdIg==</vline></verbatim>
<para>The above behaves completely differently in Tk 8.4 and 8.5 at present.</para>
</section>
<section title="Implementation">
<para>A full implementation, with documentation and tests is available at SourceForge [<url ref="http://sf.net/tracker/?func=detail&amp;aid=1247835&amp;group_id=12997&amp;atid=112997"/>]. The bug report also contains some further discussion on this issue.</para>
</section>
<section title="Copyright">
<para>This document has been placed in the public domain.</para>
</section>
</body></TIP>
