4coder » Forums » Indent Settings
PsyKing
Anthony Smith
7 posts

Mwahahaha

#11158 Indent Settings
6 months, 3 weeks ago

Is there a way to customize the tab or autoindent sizing or are settings for that in the works?

I see what I wish to see and complain about that which I don't.
Mr4thDimention
Allen Webster
266 posts
2 projects

Heyo

#11159 Indent Settings
6 months, 3 weeks ago

There is no such setting if you are talking about the virtual whitespace system, but I have been wanting to add that so if that's what you mean I'll try to bump it up the todo list.

If you mean the indenter for the actual text and you have access to the customization code, the in 4coder_auto_indent.cpp you will see "#define DEF_TAB_WIDTH 4" on line 23. By setting that you can adjust how many spaces are given to an indentation. There is also DEFAULT_INDENT_FLAGS you can set that to any of the options listed here: Indent Flag Docs.
PsyKing
Anthony Smith
7 posts

Mwahahaha

#11160 Indent Settings
6 months, 3 weeks ago Edited by Anthony Smith on March 4, 2017, 12:19 a.m.

Mr4thDimention
There is no such setting if you are talking about the virtual whitespace system, but I have been wanting to add that so if that's what you mean I'll try to bump it up the todo list.


Yeah, that's what I was talking about. It would be awesome if it was something that we could set programmatically at runtime instead of at compile time.

Mr4thDimention
If you mean the indenter for the actual text and you have access to the customization code, the in 4coder_auto_indent.cpp you will see "#define DEF_TAB_WIDTH 4" on line 23. By setting that you can adjust how many spaces are given to an indentation. There is also DEFAULT_INDENT_FLAGS you can set that to any of the options listed here: Indent Flag Docs.


Great! Now I know how that works... Does 4coder default to using spaces instead of tabs for the autoindent?

I see what I wish to see and complain about that which I don't.
Mr4thDimention
Allen Webster
266 posts
2 projects

Heyo

#11161 Indent Settings
6 months, 3 weeks ago

Yeah I want to build out the code flowing stuff some more, the current version still has some rough edges. I plan to work on it once Unicode support is good.

Yes 4coder uses space by default.
PsyKing
Anthony Smith
7 posts

Mwahahaha

#11165 Indent Settings
6 months, 3 weeks ago

Mr4thDimention
Yeah I want to build out the code flowing stuff some more, the current version still has some rough edges. I plan to work on it once Unicode support is good.


Alright. Are settings that will allow us to specify how we want some things autoindented or not autoindented planned as well?

I see what I wish to see and complain about that which I don't.
Mr4thDimention
Allen Webster
266 posts
2 projects

Heyo

#11166 Indent Settings
6 months, 3 weeks ago

Yes the plan is to make the indentation rule pretty flexible, perhaps on par with emacs' own indentation customizations.
ndcube
Andras Koczka
5 posts
#12278 Indent Settings
3 months ago

Hi Allen,

I tried to set DEF_TAB_WIDTH to 2 (on version 4.0.20) but everything still looks the same in the editor (4 wide indents), also some of the closing braces are off to the right by 2, but that is noticeable only if you check it with another editor or diff the files, in 4coder it is still rendered as before.

I would like to use 4coder for writing the Windows platform layer for my project, but I use 2 space indentation in all my code.

Thanks,
Andras


Mr4thDimention
Allen Webster
266 posts
2 projects

Heyo

#12282 Indent Settings
2 months, 4 weeks ago

That sounds like you've got the "code wrapping" which automatically displays the code as if it had a 4 wide indent even if it has a 2 wide indent in the actual text. You can turn off code wrapping in config.4coder, then you will see the text exactly the way it is. If it still does 4 wide indents in the actual text let me know because that's definitely a bug then.
ndcube
Andras Koczka
5 posts
#12284 Indent Settings
2 months, 4 weeks ago Edited by Andras Koczka on June 26, 2017, 3:28 p.m.

I have set enable_code_wrapping to false and DEF_TAB_WIDTH to 2, but it still uses the 4 wide indent, also now the ending brace bug is also visible:

void hi() {
____printf("hi");
__}

It indents lines automatically when I enter ) or ;
I really like the code wrapping feature by the way, so it would be nice if it could work with 2 width tabs as well, actually I like it so much that I would rather switch to use 4 width tabs than not using that feature :)


Also, not related to this, but the automatically_save_changes_on_build only works for me when I use alt-m, but it does not work if I use my project.4coder setting:
fkey_command_win[1] = {"build.bat", "*compilation*", true};

Which kinda make sense, but is there a way to force saving here as well?
Mr4thDimention
Allen Webster
266 posts
2 projects

Heyo

#12285 Indent Settings
2 months, 4 weeks ago

Huh yep that's a bug. I usually ignore the text indenting system these days since I just use code wrapping. I'll dig into it and figure out what's going on. Can you email me with your customization code and a sample code file that it indents incorrectly for you? That often makes these things go more quickly. Email me at [email protected].

The current code wrapping engine is mostly a proof of concept but the way it turned out customization is almost impossible. The new buffer engine in 4.1.X will feature fully C-customizable wrapping and indenting in the code wrapping feature.

Yes you can make your project commands save changes too. You just have to add an extra true to the command:
1
fkey_command_win[1] = {"build.bat", "*compilation*", true, true};
ndcube
Andras Koczka
5 posts
#12286 Indent Settings
2 months, 4 weeks ago

I have sent the details.
Also the autosaving now works perfectly, thanks a lot :)