*** Welcome to piglix ***

Elastic tabstops


A tab stop on a typewriter is a location where the carriage movement is halted by mechanical gears. Tab stops are set manually, and pressing the tab key causes the carriage to go to the next tab stop. In text editors on a computer, the same concept is implemented simplistically with automatic, fixed tab stops.

Modern word processors generalize this concept by offering tab stops that have an alignment attribute and cause the text to be automatically aligned at left, at right or center of the tab stop itself. Such tab stops are paragraph-specific properties and can be moved to a different location in any moment, or even removed.

A tab stop is a horizontal position which is set for placing and aligning text on a page. There are at least five kinds of tab stops in general usage in word processing or in MS Word.

In 2006, Nick Gravgaard invented elastic tabstops, an alternative way to handle tabstops, with a primary focus on editing source code in computer programming. Elastic tabstops mean programmers just use one tab between columns rather than inserting the exact number of spaces/tabs on each line in the buffer to make things line up. He has also written Always Aligned - an extension for Visual Studio which implements elastic tabstops. Elastic tabstops are also implemented in Go's tabwriter package which is used by the "go fmt" command.

Unlike traditional fixed tabstops, elastic tabstops automatically keep columns aligned, which makes them very useful for viewing/editing tab-delimited text (not just source code). When text is edited, tabstops on adjacent lines above and below the "cell" that is being changed are automatically moved to fit the widest cell of text in that column.



...
Wikipedia

...