News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Selection formatting?

Started by Furgas, July 05, 2008, 04:32:35 AM

Previous topic - Next topic

Furgas

Is it possible to format only currently selected part of the code using astyle plugin?

Ceniza

No, it's not. You can copy&paste the piece of code you want to format to a new file, format it, indent it and then replace it in the original file. The "indent it" part is what would make such a feature a bit more problematic to get right.

Furgas

Thanks for quick answer.

Quote from: Ceniza on July 05, 2008, 05:11:02 AM
The "indent it" part is what would make such a feature a bit more problematic to get right.

What about omitting that part?
When you maintain selection after formatting, the "indent it" can be done manually by pressing as many TABs as necessary.

As an option you could remember indentation level of the first line of selection, and apply it automatically to selection after formatting.

Just two cents:) I've just started to play with C::B. Great tool!

Furgas

My need for this feature comes from the lack of astyle option to ignore certain parts of file while formatting (maybe by placing some comments around a block of code which I don't want to be formatted?). There's feature request on astyle sourceforge project page but it's 7 years old... I've just added question there about it's status.

Thanks anyway.