Author Topic: Selection formatting?  (Read 4354 times)

Offline Furgas

  • Single posting newcomer
  • *
  • Posts: 3
Selection formatting?
« on: July 05, 2008, 04:32:35 am »
Is it possible to format only currently selected part of the code using astyle plugin?

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Selection formatting?
« Reply #1 on: July 05, 2008, 05:11:02 am »
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.

Offline Furgas

  • Single posting newcomer
  • *
  • Posts: 3
Re: Selection formatting?
« Reply #2 on: July 05, 2008, 05:41:21 am »
Thanks for quick answer.

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!

Offline Furgas

  • Single posting newcomer
  • *
  • Posts: 3
Re: Selection formatting?
« Reply #3 on: July 05, 2008, 02:31:41 pm »
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.