Skip to content

Commit

Permalink
Count last line if not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
pstreef committed Apr 22, 2024
1 parent 38e2367 commit 0424d2e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/openrewrite/LanguageComposition.java
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,12 @@ public PrintOutputCapture<Integer> append(@Nullable String text) {
count++;
}
}
if(!text.isEmpty()) {
char last = text.charAt(text.length() - 1);
if (last != '\n' && last != '\r') {
count++;
}
}
return this;
}

Expand Down

0 comments on commit 0424d2e

Please sign in to comment.