Spaces to Tabs (All) - behavior issues

This forum is user-to-user based and not regularly monitored by IDM.
Please see the note at the top of this page on how to contact IDM.

Spaces to Tabs (All) - behavior issues

Postby ridgerunner » Wed May 16, 2007 3:07 pm

The "Spaces to Tabs (All)" feature needs work (IMHO):

1. It replaces single spaces between words within sentences. This feature should only swap multiple adjacent spaces with tabs.
2. It replaces spaces within quotation marks i.e. quoted strings.

I realize that there is another "Spaces to Tabs (Leading)" option, but for me as a programmer, there are two areas of white space that need to be condensed; 1.) the leading indented space before the code and 2.) the space between the end of the code and the comment (which I place at the end of every line writing assembly language.)

It would be nice if this feature was a bit more configurable. But a "tabify" function should never replace a single space with a tab and quoted strings should never be messed with by default. Note: the MS Visual C++ editor's "tabify" functions does behave properly so I am forced to use it (Arrg) for my tabbing/de-tabbing needs (But I'd much rather use UE!)
User avatar
ridgerunner
Basic User
Basic User
 
Posts: 18
Joined: Thu Sep 15, 2005 11:00 pm
Location: SLC, UT USA

Re: Spaces to Tabs (All) - behavior issues

Postby maryv » Wed May 16, 2007 5:36 pm

Sounds like it might be worth your time to write a macro to do the conversions, and just run it.
User avatar
maryv
Basic User
Basic User
 
Posts: 26
Joined: Wed Mar 21, 2007 11:00 pm

Re: Spaces to Tabs (All) - behavior issues

Postby Mofi » Thu May 17, 2007 10:38 am

I agree with maryv. Write a macro for your need. I have 2 ideas how to do it.

1) In a loop search for multiple spaces at start of a line or before a comment and use SpacesToTabs on every selection created with every find.

2) Replace all single spaces and spaces inside strings to a different character like the non breaking space (dezimal code 160). Then use SpacesToTabsAll for whole file. Finally replace all non breaking space back to normal space with a single simple replace all.

Advantage of a macro: You can make it language dependent by evaluating the file extension for example.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4051
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Spaces to Tabs (All) - behavior issues

Postby ridgerunner » Fri May 18, 2007 7:49 am

Thanks for the quick response and suggestions. The idea of using a macro to selectively replace spaces as a function of filetype is somewhat intriguing. In the meantime, I'm using TABINS.EXE and TABDEL.EXE command line utilities which I wrote a long time ago. (Or MSVC if I'm working with C files).

Interestingly, the UE documentation for scripting (for the "spacesToTabsAll" command) states that:
"...If the Tab Stop Value is set to three, a group of three spaces together would be required to convert to a tab. Fewer than three spaces together would not be converted."

This is not a real pressing issue, just a minor annoyance. But I do need to practice up my (recently learned) javascript skills, so maybe I'll give it a go... Thanks again - rr
User avatar
ridgerunner
Basic User
Basic User
 
Posts: 18
Joined: Thu Sep 15, 2005 11:00 pm
Location: SLC, UT USA


Return to UltraEdit General Discussion