Skip to content

Commit

Permalink
edits
Browse files Browse the repository at this point in the history
  • Loading branch information
mwsmws22 committed Oct 26, 2024
1 parent 501cdb0 commit 123f009
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
@Immutable
public final class Formatter {

public static final int MAX_LINE_LENGTH = 100;
public static final int MAX_LINE_LENGTH = 120;

static final Range<Integer> EMPTY_RANGE = Range.closedOpen(-1, -1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ private List<String> wrapLineComments(List<String> lines, int column0) {
result.add(line);
continue;
}
while (line.length() + column0 > Formatter.MAX_LINE_LENGTH) {
int idx = Formatter.MAX_LINE_LENGTH - column0;
while (line.length() > Formatter.MAX_LINE_LENGTH - column0) {
int idx = line.length() - 1;
// only break on whitespace characters, and ignore the leading `// `
while (idx >= 2 && !CharMatcher.whitespace().matches(line.charAt(idx))) {
while (idx >= 2
&& (!CharMatcher.whitespace().matches(line.charAt(idx))
|| idx > Formatter.MAX_LINE_LENGTH - column0)) {
idx--;
}
if (idx <= 2) {
Expand Down Expand Up @@ -179,4 +181,3 @@ private static boolean javadocShaped(List<String> lines) {
return true;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/
public final class JavadocFormatter {

static final int MAX_LINE_LENGTH = 100;
static final int MAX_LINE_LENGTH = 120;

/**
* Formats the given Javadoc comment, which must start with ∕✱✱ and end with ✱∕. The output will
Expand Down

0 comments on commit 123f009

Please sign in to comment.