      A DISCOURSE UPON THE HORIZONTAL TAB IN WORDSTAR (DOS)
                  by John G. Bennett, 72431,1407
                Copyright 1995 by John G. Bennett
            (This is not an official SoftKey Document)

There are two different things called tabs in files.  One is the 
ASCII Horizontal Tab character, ^I (09 Hex).  This may be found 
in ASCII (non-document) files and is allowed in WS document 
files, mainly for compatibility with older versions of WS and for 
importing material containing ASCII tabs.  The other is a Tab 
symseq (symmetrical sequence), a 12 byte sequence found only in 
WS document files.  There are six kinds of symseq tabs: hard 
tabs, soft tabs, decimal tabs, center line tabs, right align 
tabs, and dot leader tabs.  All symseq tabs contain information 
about their positioning on the page in HMI (Horizontal Motion 
Index) units -- an HMI is 1/1800 inch.  Such information is not 
contained in an ASCII tab: since it's just a single character it
doesn't contain anything.

ASCII tabs are a nuisance: what they mean depends entirely on the 
software or hardware dealing with them.  A common default for 
ASCII tabs is that they expand to the eighth column; that is to 
say, the next character after a tab is placed in the column after 
the next one that is a multiple of 8; that's how DOS displays 
them when it TYPEs a file, for instance.  Some printers have this 
as a default, but most printers allow the tabs to be set in 
various ways.  So there's no guarantee that an ASCII tab will be 
displayed on a terminal in the way it will print.  Furthermore, 
software can be set to do various things with tabs (as WS can be 
set to display ASCII tabs with various tab stops in Non-Document
mode).  And of course, the eighth column has no meaning when one 
is dealing with proportional text.  ASCII tabs are entered in a 
Non-Document by pressing the TAB key (unless variable tabs are 
set; see below), or ^PI; in a Document file they can only be 
entered with ^PI.  I'm not sure how ASCII tabs are printed in a 
document; I think they are treated as though tab stops were set 
every .8 inches.

Symseq tabs get into document files in different ways, depending 
on the sort of tabs they are.  When you press the tab key while 
entering text you get a hard tab, decimal tab, or no tab, 
depending on whether the next tab stop on the line is a regular 
tab, decimal tab, or non-existent.  Soft tabs, center tabs, and 
right align tabs get into the file as a result of formatting and 
are automatically added or removed as formatting changes.  Dot 
leader tabs are put into the file by ^P. entered while entering 
text.

Since the symseq tab contains information about its absolute 
position, it can mostly maintain its position through font 
changes, and is to some slight degree device independent.  WS can 
try to put it in the right place even on different printers.  Of 
course, different font widths and different horizontal motion 
mechanisms in different printers can defeat this.  Printing a 
file with a PDF other than that with which it was created is 
always a risky business.

Tab stops can be set in WS Document files in a variety of ways.  
In versions beginning with 5.5, the default settings have been in 
the default paragraph style (Body Text, unless this is changed in 
WSCHANGE at DAFB).  They may be changed by using paragraph styles, 
the .tb dot command, or the .RR dot command (to insert a ruler 
line), or you can insert the current ruler line settings with ^OO 
and edit the result.

Versions of WS before 7.0 could search and replace only ASCII 
tabs.  7.0 will search and replace ANY tab when ^PI inserts a ^I 
in the search field, and WS will insert a symseq hard tab, if a 
tab is replaced in the replace field.  It is nice that the search 
and replace function learned to recognize symseqs, but it is 
practically useless for replacing many tabs, since one almost 
never wants to replace soft, center, right-align and dot-leader 
tabs along with the ASCII and hard ones, and the search function
can't distinguish among the sorts of tabs.

The behavior of tabs in Non-Document files is controlled by a 
screen reached in WSCHANGE by entering DCBD.

This screen is one of those user-hostile parts of WSCHANGE 
designed to drive the user to distraction.  It is scarcely 
explained at all, and exceedingly inconvenient to use; for most 
purposes, in fact, you are better off patching the table at 
EDCOND directly.  (Consult the PATCH.LST file before trying 
this.)

However, the idea here is a very convenient one: you can set WS's
non-document handling of tabs and auto indenting according to the
extension of the file you are editing.  Thus (by default) if you
are editing a non-document file with the extension .PAS (assumed
to be a Pascal program source) WS will give you tab stops every 
two columns and auto indent ON by default.   (It's convenient to 
make an addition to this table for the extension .WSM; I'm not 
sure whey they didn't do that in the factory shipped version.)  
One of the columns in this table is mysterious and unexplained --
variable tabs.  When you use variable tabs, WS doesn't put the 
ASCII tab character (09) into the file when you press the tab 
key; it puts spaces in instead, and the tab stops are set 
according to the default ruler line at the label RLRINI.  (You 
set this in WSCHANGE at DAEA.)  You can still put an ASCII tab in 
with ^PI.

You can change the way Tabs display on the screen in Non-Document 
Mode, by pressing ^OI.  You can choose to have tabs set at every 
2, 4, 8, or 16 columns.  Note that this will only affect the way 
the tabs are displayed while editing.  It will not affect how 
they print, no matter how you print the file.

WS will print tabs in a Non-Document file according to the file 
extension, provided you tell it in the print dialogue box that 
you are printing Unformatted Text (7.0) or Non-Document (earlier 
versions).  When you do this, WS also prints any lines with a dot 
in the first column (dot commands).

Beware of modifying the table of file extensions, tab settings, 
and autoindent settings, however.  If you tell WSCHANGE you want
to modify this table it wipes out the whole thing and asks you to
enter the information for the whole table one item at a time. As
you do so, the previous version of the table scrolls off the 
screen.  This is fine if you want to kill the table, but not so 
much fun if you just want to add an entry at the end of it.

