|
back to the help index
Tabs/Emulated Tabs
Changing the Tab Distance
Tabs are important for programming in languages which use indentation to show
nesting, as short-hand for producing white-space for leading indents. As a
programmer, you have to decide how to use indentation, and how or whether tab
characters map to your indentation scheme.
Ideally, tab characters map directly to the amount of indent that you use to
distinguish nesting levels in your code. Unfortunately, the Unix standard
for interpretation of tab characters is eight characters (probably dating
back to mechanical capabilities of the original teletype), which is usually
too coarse for a single indent.
Most text editors, NEdit included, allow you to change the interpretation of
the tab character, and many programmers take advantage of this, and set their
tabs to 3 or 4 characters to match their programming style. In NEdit you set
the hardware tab distance in Preferences -> Tabs... for the current window,
or Preferences -> Default Settings -> Tabs... (general), or Preferences ->
Default Settings -> Language Modes... (language-specific) to change the
defaults for future windows.
Changing the meaning of the tab character makes programming much easier while
you're in the editor, but can cause you headaches outside of the editor,
because there is no way to pass along the tab setting as part of a plain-text
file. All of the other tools which display, print, and otherwise process
your source code have to be made aware of how the tabs are set, and must be
able to handle the change. Non-standard tabs can also confuse other
programmers, or make editing your code difficult for them if their text
editors don't support changes in tab distance.
Emulated Tabs
An alternative to changing the interpretation of the tab character is tab
emulation. In the Tabs... dialog(s), turning on Emulated Tabs causes the Tab
key to insert the correct number of spaces and/or tabs to bring the cursor
the next emulated tab stop, as if tabs were set at the emulated tab distance
rather than the hardware tab distance. Backspacing immediately after entering
an emulated tab will delete the fictitious tab as a unit, but as soon as you
move the cursor away from the spot, NEdit will forget that the collection of
spaces and tabs is a tab, and will treat it as separate characters. To enter
a real tab character with "Emulate Tabs" turned on, use Ctrl+Tab.
It is also possible to tell NEdit not to insert ANY tab characters at all in
the course of processing emulated tabs, and in shifting and rectangular
insertion/deletion operations, for programmers who worry about the
misinterpretation of tab characters on other systems.
back to the help index
|