TIP #256: Implement Tabular and Wordprocessor Style Tabbing
_____________________________________________________________________________
TIP:	256
Title:	Implement Tabular and Wordprocessor Style Tabbing
Version:	$Revision: 1.15 $
Authors:	Vince Darley <vince@santafe.edu>
	Vince Darley <vincentdarley@users.sourceforge.net>
State:	Final
Type:	Project
Tcl-Version:	8.5
Vote:	Done
Created:	Fri Aug 12 00:00:00 UTC 2005
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's text widget.
Overview
Tk's text widget has historically only supported a tabular style of tabbing, where the n'th tab character is associated explicitly with the n'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 wordprocessor (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.
This TIP proposes to add wordprocessor-style tabbing to Tk's text widget.
Tk 8.4 only supports tabular tabbing (except for the special -tabs  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'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.
Proposal
A new -tabstyle configuration option will be added to the text widget, taking the values wordprocessor or tabular to specify the style of tabbing. The same option will also be added to tags in the text widget (which, as usual, will also allow an empty value for the configuration option). The default style of tabbing will be tabular for compatibility with Tk 8.4. Neither style name may be abbreviated.
As a result of this change, abbreviations such as -ta or -tab 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 grid). 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.
In addition the strange difference in Tk 8.4 between an empty -tabs value and any other value will be changed for Tk 8.5 - it will use the -tabstyle option to determine how to interpret tabs under all circumstances, and use the -tabs list simply to determine the location of the tab stops.
Here's an example usage:
pack [text .t]
.t configure -tabs 0.5i 1.0i 1.5i 2.0i 2.5i 3.0i 3.5i 4.0i 4.5i
.t insert end "a