Reply To: Global replace of tab char does not always work

Product Compare Forums Multi-Edit Support Global replace of tab char does not always work Reply To: Global replace of tab char does not always work

Bret Sutton

That would work fine if I wanted to convert each tab character to an arbitrary number of spaces. But I want to convert each tab character to a single other character. The search-and-replace will work just fine as long as I have ‘Expand tabs to tabs’ checked.

This is my first venture into using the ‘Expand tabs to tabs’ option, and I just ran into something else. I’m creating a new file, and I type in "one<tab>two<tab>three". In hex mode, I expect to see this:[code:2ttx34cg]6F 6E 65 09 01 01 01 01 74 77 6F 09 01 01 01 01 74 68 72 65 65[/code:2ttx34cg]but instead I see this:[code:2ttx34cg]6F 6E 65 20 20 20 20 20 74 77 6F 20 20 20 20 20 74 68 72 65 65[/code:2ttx34cg]If, however, I use [Alt][KP-0,0,9] or [Ctrl-I] instead of the tab key, a tab character is inserted, and the result does look like the first example above. In other words, the Tab key is still inserting spaces.


Well, that turns out to be a rhetorical question. It’s because the Tab key is assigned to the Tab macro. If I remove that assignment, then the Tab key will insert either a tab or spaces, depending on the ‘Tab expand’ setting. So I guess the question then becomes, why wasn’t the Tab macro coded with[code:2ttx34cg]Text("\t");[/code:2ttx34cg]rather than[code:2ttx34cg]Tab_Right;[/code:2ttx34cg]Rhetorical once again: an unmodified Tab key always acts as if it’s in insert mode. And an unmodified Shift-Tab does exactly the same thing as the Tab (it doesn’t go backwards). So the Tab macro is forced to use Tab_Right and Tab_Left. Which prevents it from inserting real tab characters. Of course, I can run Text | Convert tabs. But that will also convert runs of spaces that I have entered. In other words, it cannot distinguish when I have used the Tab key and when I have used the space bar.

What we have here is a conflict between a stream of symbols and control characters, and their representation in two-dimensional space. Should the Tab key generate an actual tab character in that space? If so, then what does that imply about the Shift-Tab (Backtab)? Wormholes and relativity, I believe! :lol: