Right, this is the correct way.
However, white space alignment is anyway inherently wrong, at least if you do GUI work.
Nevertheless I've seen a lot of SPACE alignment (legacy) code ...
HS2
@Wanderer:
You could replace the org. command in util.e w/ this v11-v12 merge providing the choice ...
Edit: Of course you could add this macro to your personal collection instead of patching the product.
_command void convert_spaces2tabs( boolean all = false ) name_info(','VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL)
{
clear_message();
int old_mark_id = _duplicate_selection('');
int mark_id = -1;
int ln=0;
int col=0;
int left_edge=0;
int cursor_y=0;
// HS2-ADD: better message text #1
area := "Selection";
if (!select_active()) {
// HS2-ADD: better message text #2
area = "Whole buffer";
ln=p_line;col=p_col;left_edge=p_left_edge;cursor_y=p_cursor_y;
mark_id = _alloc_selection();
_show_selection(mark_id);
top(); _select_line(mark_id);
bottom(); _select_line(mark_id);
}
if ( all )
{
filter_selection('_tabify_filter','',true);
}
else
{
// HS2-ADD: old but v11 behaviour: leading TABs only
_end_select();
esline := p_line;
_begin_select();
bsline := p_line;
// For every line in the selection, convert indent spaces to tabs:
old_value := p_indent_with_tabs;
p_indent_with_tabs = true;
_str line;
int i;
for ( i = bsline; i <= esline; i++ )
{
p_line = i;
get_line( line );
typeless non_blank=verify( line," \t");
if ( non_blank )
{
replace_line( indent_string(text_col(line,non_blank,'I')-1) :+ substr(line,non_blank) );
}
}
p_indent_with_tabs = old_value;
}
if (mark_id > 0) {
_show_selection(old_mark_id);
_free_selection(mark_id);
p_line=ln;p_col=col;set_scroll_pos(left_edge,cursor_y);
}
// HS2-ADD: better message text #3
message (area " de-spaced (" (all ? "all" : "leading only") ")");
}