Is there a way for UE to fill end of line with tabs to the specified column?

Is there a way for UE to fill end of line with tabs to the specified column?


    Sep 27, 2011#1

    I currently do this:

    1. Search/replace "^r^n" with "^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^r^n"
    2. Move cursor to column 80
    3. Record macro - a) SHIFT + END to mark to end of line, b) DEL to delete extra tabs, c) move cursor to line below, d) end macro record
    4. Playback macro for all lines

    Is there a way to fill to the end of a line with tab to column 80 (regardless of number of tabs, some lines may have only one, some may have 5, some may have none). Or with any other character (space etc.)

    The above technique can be used but I have a feeling that UE already has this built in just can't find it :)

    Grand MasterGrand Master

      Sep 27, 2011#2

      There is no built-in command to insert tabs at end of a line. Usually the opposite is needed which is the reason for command Format - Trim Trailing Spaces.

      However, what you want can be easily achieved with a macro as long as your version of UltraEdit supports search in column.

      IfColNumGt 1
      IfColNumGt 1

      Find RegExp "$"
      Replace All "^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t"
      Find SearchInColumn 80 -1 "^t"
      Replace All ""

      The first UltraEdit regular expression Replace All inserts 15 tabs at end of every line which has a line termination. The red formatted code guarantees that last line of file has also a line termination. You can remove this code part if you don't need it because your files always end with a line termination.

      The second non regular expression Replace All deletes all tabs found AFTER column 80 in every line.

      Note 1: The Search In Column feature starts column counting with value 0 for the first column while the column number displayed on the status bar starts column counting with value 1 for first column. The column count start value (0/1) on the ruler can be configured. With looking on the column number in the status bar the second Replace All deletes all tabs found at column 81 or beyond.

      Note 2: A tab at column 81 or beyond between other characters is also deleted. The second Replace All does not delete only trailing tabs!