Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter FiveGeneral Functions (continued)

5.7 Tabs and Tab Characters

5.7.1 Overview

The tab character (0x09 or \t) can be used to skip to a forward tab position on a line of text. Conventionally, for simple text, the tab character would cause the ‘character position’ on a line to move to the next tab position, usually every 8 characters. Over the last decade, many editors and authors have used spacing other than 8 characters.

Once characters within a string (or line of text) are referenced and tabs are present, the positions of characters may not be as expected. For example:

                    1 1 

0 1 2 3 4 5 6 7 8 9 0 1

W O R D         N E X T

If the space at position 4 though 7 are spaces, then referencing position 8 will result in the character ‘N’. However, in the case of a tab, then the ‘N’ will actually be at position 5. We refer to these positions as realized and native positions. In other words, if the tabs were displayed in their rendered or realized position, the apparent position is 8. In native mode the string appears as:

0 1 2 3 4 5 6 7 8 9

W O R D → N E X T

The raw data is stored with the tab character but is displayed without them. For display or easy character reference, the tabs can be expanded and replaced with spaces. However, if the tabs are expanded with spaces, the tab position information is maintained but the actual tab characters are lost. To maintain tabbing intelligence, the characters can be replaced with a filler (0x08) such that within the application’s text editor and Legato the tabs can be restored. Since a backspace character in a stream is meaningless, it can be used without consequence.

                    1 1 

0 1 2 3 4 5 6 7 8 9 0 1

W O R D → ← ← ← N E X T

This string can be referenced by realized positions and “collapsed” back to native tab text. This only works if the expansion character is 0x08. Note that all word/text testing functions accept 0x08 as a word space.

The spacing interval is not really relevant except, ideally, it should match the author’s intent. The tab functions within Legato default to 8 but can be set from 1 to 64.

5.7.2 Tab Functions