News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

How to indent whitespace in selection?

Started by Kahenraz, February 19, 2019, 10:27:48 AM

Previous topic - Next topic

Kahenraz

When I select a block of text and perform an indentation with tab, I want the whitespace to indent along with it. The reason for this is that I want my cursor to remain within the same horizontal block as I cursor down through the code. It bothers me that it truncates all the way to the left.

I can't seem to find a way to do this in Code::Blocks. Is there a setting for something like this?

Thank you.


oBFusCATed

Can you try to give a better explanation? I'm not sure what the problem is...

You want the cursor to move with the indentation?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Quiss

I think the problem is in line 11 (empty line), it doesn't indent when you select with multiple lines and press tab.

Kahenraz

Quote from: Quiss on February 20, 2019, 09:17:15 AM
I think the problem is in line 11 (empty line), it doesn't indent when you select with multiple lines and press tab.

This is correct. I want the whitespace of my selection to be indented along with the rest of the code.

sodev

Does not every IDE these days by default remove trailing whitespace? And isnt this a good thing for git and the like?

Kahenraz

Not if it directly contradicts a coding style. Every time I indent something, I have to manually cursor around and indent the whitespace.

I don't have this problem on Eclipse as it will both indent whitespace in selections as well as with the code style formatter. The same goes for any of my other editors.

This is my first time using Code::Blocks and I was very surprised as this behavior.

As far as Git is concerned, it is a non-issue either way as it has options natively to ignore whitespace changes.

stahta01

#6
Did you make sure that "Strip Trailing Blanks" is unchecked.

It then works for me once I have the spaces indented once; does not change zero spaces on a line.
Edit2: It looks like you already noticed this.

Settings -> Editor
Tab: Editor Setting
Section: End of Line options

Tim S.



C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Kahenraz

The problem seems to be that the IDE will not indent lines which are empty.

Can an option be added to allow this? Is this behavior that can be modified by a plugin?

Thank you.

oBFusCATed

I doubt a plugin can do this. I tested scite and geany and both editors behave the same as codeblocks, so I think the change should be introduced in scintilla's Indent function (Editor::Indent).
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]