Replace Blank

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
christian
Posts: 1
Joined: Tue Nov 30, 2004 7:44 pm

Replace Blank

Post by christian »

I'm a absolute beginner and i have the problem to replace Tabs with Blanks. I can find the Tabs ( \t) with search and replace, but i didn't find out how to replace with Blanks. Which sequence is to key in into the replace field.
kind regards
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

You can't do it that way, because different tabs need to be replaced by different numbers of spaces.

Go to Document Properties (Alt+Enter), select the "Tabulation" tab, set "Default tab spacing" to whatever you want, select "Convert existing tabs to spaces when saving files". Than make sure the file needs saving (e.g. by overwriting a space with a space), and save it.
bveldkamp

Post by bveldkamp »

AFAIK you can just type in the desired number of spaces in the "Replace" box. Works for me anyway.

Berend
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

bveldkamp wrote:AFAIK you can just type in the desired number of spaces in the "Replace" box.
Doesn't work for tabs preceded by spaces or for interior tabs.
bveldkamp

Post by bveldkamp »

Dunno, but all tabs are replaced by spaces. Maybe if you want to preserve indenting you have a problem, but that's not what the OP asked for.

What exactly is an "interior tab"?
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

bveldkamp wrote:What exactly is an "interior tab"?
One with at least one non-white-space character somewhere to the left of it, used, perhaps, to line up a column on the right.
bveldkamp

Post by bveldkamp »

OK, but I still don't see why you wouldn't be able to replace those by blanks. Or maybe I'm completely missing the point?
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Probably the primary use of tabs is to line text up vertically. If that is their purpose in this case, and if the effect is to be maintained, then the number of spaces required to replace each individual tab character depends on the positions of the tab stops and on the position of that tab. If the tab stops are at columns 1, 9, 17, 25, ... then a tab at column 9 needs to be replaced with 8 space characters, one at 10 with 7,... one at 16 with 1, one at 17 with 8, and so on.

I presumed that the original poster's problem was not merely the inability to type a space in the "Replace with" field. But the original message is ambiguous, and I may be wrong.
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Could replace the Tab with one space, then replace multiple spaces with whatever quantity is needed if alignment is an issue. Just means multiple S/R passes vs. one.
Hope this was helpful.............good luck,
Bob
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

No. That's not how tabs work. Different instances of tab represent different amounts of white space. That's the point of their existence. Besides, how can changing single tabs to single spaces help as an intermediate step?
charles
Posts: 20
Joined: Mon Dec 27, 2004 5:11 pm
Contact:

Tabs

Post by charles »

Aren't tabs more reference to fixed column rather than "amount of whitespace" ?
As far as tab handling in editing/RegExp, they're treated as a single char ...
Post Reply