Skip to content

Commit c0af172

Browse files
committed
Fix column handling for non-tokens
MOE_MIGRATED_REVID=137985253
1 parent 18da149 commit c0af172

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

core/src/main/java/com/google/googlejavaformat/Doc.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,8 @@ Range<Integer> computeRange() {
744744
@Override
745745
public State computeBreaks(CommentsHelper commentsHelper, int maxWidth, State state) {
746746
text = commentsHelper.rewrite(tok, maxWidth, state.column);
747-
return state.withColumn(text.length() - Iterators.getLast(Newlines.lineOffsetIterator(text)));
747+
int firstLineLength = text.length() - Iterators.getLast(Newlines.lineOffsetIterator(text));
748+
return state.withColumn(state.column + firstLineLength);
748749
}
749750

750751
@Override
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class T {
2+
{
3+
f(
4+
1 /* 1 */, 2 /* 2 */);
5+
}
6+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class T {
2+
{
3+
f(
4+
1 /* 1 */,
5+
2 /* 2 */);
6+
}
7+
}

0 commit comments

Comments
 (0)