Tucker Kolpin
8 posts
4.0.25 Inconsistent indenting between auto_tab_range and auto_tab_line_at_cursor
Edited by Tucker Kolpin on Reason: Initial post
Noticed something interesting in 4coder 4.0.25, don't know if this stuff has already been fixed in more recent versions.

I'm writing in C so I can't use the raw string literals from C++.
So I have this code to kinda get around that...

 1 2 3 4 5 6 7 8 9 #define STR(x) #x char *ShaderCode = STR( #version 330 \n void main() { // Some shader code } ); 

Some things I noticed.
-Indenting a single line with "auto_tab_line_at_cursor" formats the code just like a regular block of code which is exactly what I'd want.
-Indenting a range with "auto_tab_range" formats the code by removing all the spaces at the start of each line.
-The "\n" is highlighted red even though this is completely legal.
Allen Webster
473 posts / 4 projects
Heyo
4.0.25 Inconsistent indenting between auto_tab_range and auto_tab_line_at_cursor
The parser doesn't understand what you're trying to do because it thinks everything inside STR is a parameter, which gets treated differently than normal code. In more recent versions I fixed a bug that caused auto_tab_range and auto_tab_line_at_cursor to disagree on how much indentation to use, but they now both agree NOT to indent that code. It can't tell the difference between code inside a macro parameter and an expression, and I'm not sure how it could ever tell the difference well enough to make this behave exactly how you expect...

Also, yes the \n is legal, but only after expanding the macro, and 4coder doesn't try to fully evaluate the preprocessor when it does that coloring, it just makes that determination from an initial lexer pass.