Pelles C forum
Pelles C => Feature requests => Topic started by: Romashka on May 02, 2009, 03:01:36 PM
-
Currently 'Convert to -> Tabs (from spaces)' replaces every X spaces with a tab, but IMO it is reasonable to do this only for leading spaces.
The reason is that if someone loads your spaces-to-tabs converted source into his/her editor that has a different 'spaces in tab' number set - the identation changes would be fine, but in-text identation will be corrupted.
Suppose we have this code:
#include "header.h" /* some comment*/
#include "another_header.h" /* some comment*/
#include <stdlib.h> /* some comment */
if (abc) {
foo = bar;
}
Here's what happens if user set 4 spaces in tab, converted spaces to tabs and loaded the converted file with 8 spaces in tab setting:
#include "header.h" /* some comment*/
#include "another_header.h" /* some comment*/
#include <stdlib.h> /* some comment */
if (abc) {
foo = bar;
}
If 'Convert to -> Tabs (from spaces)' would convert only leading spaces - such corruption could be avoided.
-
I don't really care either way since I don't think tabs should be used in source files (at all). I can only say two things 1) it may be (slightly) easier to understand/explain the current behavior, and 2) since it has worked this way for a while now, I'm 110% sure someone will complain loudly about the change.