Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [xtext-dev] How are tabs counted in the length of a line?

Done. https://bugs.eclipse.org/bugs/show_bug.cgi?id=347530

Mary

--------------------------------------------------
From: "Mary Komor" <mary.mailinglist@xxxxxxxxx>
Sent: Friday, May 27, 2011 5:45 PM
To: "Xtext dev list" <xtext-dev@xxxxxxxxxxx>
Subject: Re: How are tabs counted in the length of a line?

Seems like copy/paste ate up one of the spaces in the indentation in the actual results that I stated in my original email.

The actual result is supposed to be as follows:
-----
test indentation {
       void func(x:int, y:int,
       s:javalangString,
       foo:javasqlDate,
       blupp:mylongtype,
       msads:adshdjkhsakdasdkslajdlsask,
       x:x, a:b, c:d);
       }
-----

So, the line " void func(x:int, y:int," exceeds the max line width of 30 and should have been wrapped (before y:int).

Mary

--------------------------------------------------
From: "Mary Komor" <mary.mailinglist@xxxxxxxxx>
Sent: Friday, May 27, 2011 1:52 AM
To: "Xtext dev list" <xtext-dev@xxxxxxxxxxx>
Subject: How are tabs counted in the length of a line?

How are tabs counted when calculating the length of a line (to decide whether it should autoLineWrap or not)? Do they count as 1 or 4 (1 tab = 4 spaces)?

According to FormatterTest.testIndentationAndLineWrap() in the test suite, for the input

-----
"test indentation { void func(x:int,y:int,s:javalangString, foo:javasqlDate, blupp:mylongtype, msads:adshdjkhsakdasdkslajdlsask, x:x, a:b, c:d ); }"
-----

if I use the following config:

-----
c.setAutoLinewrap(30);
// increment the indentation twice after a "{"
c.setIndentationIncrement().after(f.getTestIndentationAccess().getLeftCurlyBracketKeyword_1());
c.setIndentationIncrement().after(f.getTestIndentationAccess().getLeftCurlyBracketKeyword_1());
-----

then the actual result is as follows:

-----
test indentation {
       void func(x:int, y:int,
       s:javalangString,
       foo:javasqlDate,
       blupp:mylongtype,
       msads:adshdjkhsakdasdkslajdlsask,
       x:x, a:b, c:d);
       }
-----

But doesn't the line " void func(x:int, y:int," exceed 30 characters? By my count, that line has 31 characters and should have been wrapped. Am I miscounting?

Regards,

Mary




Back to the top