Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » formatter doesn't remove empty lines
formatter doesn't remove empty lines [message #933741] Fri, 05 October 2012 05:49 Go to next message
Vlad Dumitrescu is currently offline Vlad Dumitrescu
Messages: 318
Registered: July 2009
Location: Gothenburg
Senior Member
Hi!

If I use setLineWrap(1) and there are already n lines present, they are not reduced to 1, but there will be n+1.

Consequently, when I press Ctrl-F several times in a row, then an empty line is added every time.

The same thing happens if I use setSpace("\n"): new lines just get added.

Is this how it's meant to be, or am I using it wrong?

best regards,
Vlad
Re: formatter doesn't remove empty lines [message #935236 is a reply to message #933741] Sat, 06 October 2012 17:04 Go to previous messageGo to next message
Boris Brodski is currently offline Boris Brodski
Messages: 85
Registered: July 2009
Member
Hello Vlad,


I recommend to use the setLineWrap version with 3 parameters:

public LinewrapLocator setLinewrap(int minWraps, int defaultWraps, int maxWraps)


Here you can set the minimal allowed count of lines, default count of lines and maximal allowed count of lines.
If the maximal allowed count of line overtaken, the formatter will remove some empty lines to reduce the count of it to the maximum value.


Regards,
Boris
Re: formatter doesn't remove empty lines [message #935931 is a reply to message #935236] Sun, 07 October 2012 09:33 Go to previous message
Vlad Dumitrescu is currently offline Vlad Dumitrescu
Messages: 318
Registered: July 2009
Location: Gothenburg
Senior Member
Hi Boris,

Of course I tried that too, and anyway, setLinewrap() just calls setLineWrap(1) which just calls setLineWrap(1,1,1).

After some digging, it looks like the problem appeared because of a terminal that was a little weird (could end with non-ignored whitespace). Removing that fixed it.

regards,
Vlad
Previous Topic:idea for xbase crib sheet.
Next Topic:Exporting Parser+Generator as standalone jar file
Goto Forum:
  


Current Time: Thu Aug 28 07:16:09 EDT 2014

Powered by FUDForum. Page generated in 0.01705 seconds