Python TextEditor - Inconsistent use of space and tab error

I am running into a case where the editor complains about the Inconsistent use of space and tab , however at the editor level the code looks well indented. Do you know how to avoid / suppress this issue?



Alex Iuspa

Hi Alex,

As python scripting engine does not allow it, you should ensure only spaces present in your code.
There is a possible solution:
edit.DisplayLines.UseSpaces = true; // tab character is converted to spaces when user presses tab

Additionally, upon loading text into the editor you may replace tabs with spaces like this:

        int spaces = edit.Lines.GetTabStop(0);
        edit.Text = edit.Text.Replace("\t", new string(' ', spaces));


That works very well. It caused headaches for the uses, thanks!