alexo wrote:Is there any reason why the internal implementation of "remove indents" could not something comparable in speed to these workarounds (or even faster)?
Yes, because the internal implementation works also for not well indented lines while the macro workarounds I posted work only for well indented lines using either tabs or spaces.
Let us take a look on following example.
» is used here as a replacement for a tab character and
· as a replacement for an indenting space character.
Code: Select all
Line 1
········Indented line 2
» ········Indented line 3
················Indented line 4
··» ··» Indented line 5
» » Indented line 6
» Indented line 7
Line 8
Selecting line 3 to 7 and using the third macro solution with x = 8 on this selection produces
Code: Select all
Line 1
········Indented line 2
» ········Indented line 3
········Indented line 4
» ··» Indented line 5
» » Indented line 6
» Indented line 7
Line 8
which is definitely not wanted. The last macro solution using tabs or spaces produces
Code: Select all
Line 1
········Indented line 2
········Indented line 3
········Indented line 4
» ··» Indented line 5
» Indented line 6
» Indented line 7
Line 8
which is better, but still not correct. The remove indent command produces here the correct result which is
Code: Select all
Line 1
········Indented line 2
········Indented line 3
········Indented line 4
··» Indented line 5
» Indented line 6
» Indented line 7
Line 8
Further UltraEdit supports not only 1 fixed tab stop value. Under
Advanced - Configuration - Editor - Word Wrap / Tab Settings the
Tab Stop value field does not allow only 1 integer number to be entered, it is also possible to enter for example
16, 12, 8, 4. This means the first tab stop is after 16 characters at column 17 (column count starting with 1 for the first column as displayed in the status bar), the second tab stop value is after 12 more characters at column 29, the third tab stop is after 8 more characters at column 37, the fourth and all following tab stops each are after 4 more characters at column 41, 45, 49, 53, ... Such a tab stop configuration is useful for editing assembler files, for editing fixed column width files (using
Use spaces in place of tabs) and for viewing/editing CSV files using the tab character as separator and having always the data column widths without the need to convert the CSV file to fixed column. The Remove Indent command works for such files with different tap stop values too, but not the macro solutions.
So the internal implementation of the remove indent command is much smarter than the quick solutions using regular expression searches which work only for well indented lines using always either tabs or spaces, but never mixed. The disadvantage of the smarter implementation is that it has to analyze the indents line by line which makes it much slower. Adding indents is much easier because at start of the line just one tab character or the correct number of spaces must be inserted without the need to analyze something. Therefore this command is much faster.