Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: mkaut on February 03, 2016, 01:46:12 pm

Title: Can I prevent editor to convert spaces to tabs on indent?
Post by: mkaut on February 03, 2016, 01:46:12 pm
In all my codes, I use the "indent with tabs, align with spaces" approach, to make the formatting independent on the tab size (see for ex. http://dmitryfrank.com/articles/indent_with_tabs_align_with_spaces (http://dmitryfrank.com/articles/indent_with_tabs_align_with_spaces)).

The problem is that when I (un)indent a block of text, the CB editor converts all leading spaces to tabs, messing up the formatting.
Is there some way to turn this off?

The only think I know of is to turn off the "Tab indents" and "Backspace unindents" options, so that I can use a vertical selection to insert/delete leading tabs .. but it would be nice to make it work with Tab/Shift+Tab, to avoid reaching for the mouse..

(This is in no way connected to the new release, I have been struggling with this for many years, don't really know why I have not asked before...)
Title: Re: Can I prevent editor to convert spaces to tabs on indent?
Post by: cacb on February 03, 2016, 04:39:44 pm
I think this does it

Settings -> Editor -> General Settings ...... uncheck "Use TAB character"
Title: Re: Can I prevent editor to convert spaces to tabs on indent?
Post by: mkaut on February 04, 2016, 09:36:13 am
I think this does it

Settings -> Editor -> General Settings ...... uncheck "Use TAB character"

Sorry, but that does not help - that will just replace tabs with spaces. As I said in my original post, I am using both: tabs for indent and spaces for alignment...
Title: Re: Can I prevent editor to convert spaces to tabs on indent?
Post by: oBFusCATed on February 04, 2016, 09:55:55 am
This is not supported at the moment. Patches welcome. :)
Title: Re: Can I prevent editor to convert spaces to tabs on indent?
Post by: mkaut on February 04, 2016, 05:11:50 pm
This is not supported at the moment. Patches welcome. :)

Thanks for info. As for a patch, that is probably beyond my capabilities..