Tapatalk

Spaces to Tabs (All) - behavior issues

Spaces to Tabs (All) - behavior issues

16
Basic UserBasic User
16

    May 16, 2007#1

    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!)

    25
    Basic UserBasic User
    25

      May 16, 2007#2

      Sounds like it might be worth your time to write a macro to do the conversions, and just run it.

      6,685587
      Grand MasterGrand Master
      6,685587

        May 17, 2007#3

        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.
        Best regards from an UC/UE/UES for Windows user from Austria

        16
        Basic UserBasic User
        16

          May 18, 2007#4

          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