Page 1 of 1

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

Posted: Sat Oct 29, 2005 1:10 am
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?

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

Posted: Mon Oct 31, 2005 11:16 am
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

Posted: Mon Oct 31, 2005 7:57 pm
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.

Posted: Tue Nov 01, 2005 10:59 am
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