Re: Emulated Tabs
"Aaron W. Hsu" <[email protected]> Mon, 19 Jul 2010 04:51:50 -0400 (EDT)
| Newsgroups | gmane.editors.nedit.user |
|---|---|
| Message-ID | <[email protected]> |
Hey Offer,
On Mon, 19 Jul 2010, Offer Kaye wrote:
> Personally I've never used the checkbox "Use tab characters in..."
> simply because I don't understand it. If I'm using "Emulated tabs",
> doesn't an option to use hard tab characters exactly contradict that?
Actually, it's a rather important box, which is why I want to be able to
set it on a per-language basis.
> Either you turn on Emulated tabs or you
> turn them off. Why isn't it as simple as that?
All of these settings basically control what happens when you hit the
tab key on your computer, though they have ramifications for auto-indent
and filling as well. The basic case is when you aren't using emulated
tabs. In this case, you would normally expect that hitting the tab key
inserts an actual ASCII tab character. Okay, fair enough. But what about
when you have auto indent or you use the fill command? When NEdit fills
up the beginning of the line to match your last indent, or if you change
indentation, should it use spaces or TABS? That's what the "Use tab
characters in..." checkbox toggles.
When you are using emulated tabs this becomes more important. If you use
emulated tabs, then you can have your tab characters be one width, but
have your "fake" tabs be another. In this case, if the width isn't the
full length of a tab, then spaces are used, but what if you hit the
width of an actual tab character? Should you use tabs or spaces? In some
guides, you want to actually use spaces here, and in others, you want to
use tabs. A common case would be things like the BSD KNF C style, which
says that indents are done with 8 space tab characters, and wrapped long
lines are indented four spaces. The type of character that is inserted
matters. In this case, it's very convenient to have emulated tabs set to
four, and have the hard tab width set to 8 spaces. However, then, if you
didn't have the extra toggle, you would always be stuck with one of the
situations below:
1) Hitting tab twice in a row results in 8 spaces entered, or
2) It results in an actual TAB character being entered.
In some cases, you actually just want the spaces to be entered. In
others, it's more important that the TABS are used when you can.
My problem with the current NEdit behavior is that I can't toggle this
choice per language, so I either use all spaces everywhere, or I insert
tabs when I don't want them.
My other problem is with how emulated tabs do their thing. The current
NEdit methodology breaks the style guide above, because the style guide
requires that you not have any spaces before tab characters. That is,
something like this:
indented_call(....
wrapped long line and stuff)
stuff;
Should have the following pattern:
<tab>indented_call(....
<tab>____wrapped long line and stuff)
<tab><tab>stuff;
Now, NEdit's emulated tabs make it easy to enter this but for the
problem that for each of those tabs above, an extra four spaces will be
inserted before it. This doesn't affect the way the code renders in
NEdit, but it can have ramifications when the code is shifted, copied,
and viewed in other places. I'd like to fix this so that hitting two
tabs in a row in this situation (hard 8 tabs, emulated tabs: 4) results
in just the <tab> character, instead of <sp><sp><sp><sp><tab>, as it
currently does.
Aaron W. Hsu
--
NEdit Discuss mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/discuss