VI tabs, termcap solution?

Rahul Dhesi dhesi at bsu-cs.UUCP
Fri Feb 5 00:25:31 AEST 1988


[big discussion on tabs in vi]

To all editor designers:

There is much confusion about tabs.  Here is a quick analysis and
a specific suggestion.

There is a conceptual difference between (a) typing the tab key,
(b) inserting a tab character in a file.

When you type a tab character, you're saying "please move the
cursor to the next tab stop on my screen".  

When you insert a tab character in a file, you inserting an ASCII
0x09 (or equivalent in your favorite character set) in the file.

The two are not equivalent.

If the user has set tabs on the screen to be every 3 spaces, then when
the user types a tab, move the cursor to the next tab stop.  DON'T
insert a tab character in the file when this happens!  Instead, insert
any combination of tabs and spaces that will cause the file, when typed
to the screen with tabs set at every 8 spaces, to look correct.  In
other words, tabs in a file should always be 8-space tabs.  Tabs on the
screen should be whatever the user wants them to be.

Similarly, if the user deletes a single character, delete only a single
character as things appear on the screen.  If that single character
happened to be a tab character in the original file, replace it with
enough spaces such that the net effect is to move text back by only one
space.

Follow-ups to comp.editors, assuming such a newsgroup exists.
-- 
Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee,uunet}!bsu-cs!dhesi



More information about the Comp.unix.questions mailing list