I'm looking for ... "Un-Pretty Print"

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Wig
Posts: 4
Joined: Sat Oct 29, 2005 1:06 am

I'm looking for ... "Un-Pretty Print"

Post by Wig »

Or perhaps "ugly-print"...

I did a search throughout the forums for this and didn't find anything... so here goes.

Is there a way to 'undo' pretty print through the standard view controls?

I have a special function which returns a StringBuffer containing the markup from a view, however the data in the StringBuffer contains tons of extra white-space from the Pretty Print formatting that is difficult to remove without significant processing of the data.

Is there a way to remove any newline and tab-formatting within an edited document?

Essentially, is there a 'remove whitespace' feature?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: I'm looking for ... "Un-Pretty Print"

Post by sorin_ristache »

Hello,
Wig wrote:Is there a way to 'undo' pretty print through the standard view controls?
The Undo action available on menu Edit -> Undo (Ctrl + Z).
Wig wrote:I have a special function which returns a StringBuffer containing the markup from a view, however the data in the StringBuffer contains tons of extra white-space from the Pretty Print formatting that is difficult to remove without significant processing of the data.

Is there a way to remove any newline and tab-formatting within an edited document?
Did you develop an <oXygen/> plugin extension ? When you get the current content of the view you cannot know the sequence of user operations that were performed on the editor. For example if the Format and indent the document on open option is enabled from Window - Preference - oXygen - Editor - Format the content is pretty printed on document open before the user gets a chance to execute any editing action and in this case at least one pretty print action will be executed before you get the editor content. You have to remove whitespace yourself from the StringBuffer.

Regards,
Sorin
Wig
Posts: 4
Joined: Sat Oct 29, 2005 1:06 am

Post by Wig »

Thank you, That's what I figured.

I have a function that removes all the extraneous whitespace, but it isn't perfect. I was hoping there was a special function in the editor somewhere that would remove the 'pretty print' formatting.

Much appreciated.
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Wig,

If you look at the format and indent action as a function then that is not a bijective function, it will map any document X to a document Y but you cannot determine X if you know Y because there is a class of document {X1, X2, .... } that all will be mapped to Y so if you know Y you cannot determine which of these X1, X2, etc. was the initial document the format and indent was applied to.

Best Regards,
George
Post Reply