Skip to content

Commit

Permalink
Check for command only if previous to a new line
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Aug 11, 2024
1 parent 8a0f0a5 commit 5f7625d
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ public CommandData findCommand(String comment) {
commentOnlyCommand = true;
} else if (comment.contains(prefix)) {
final var index = comment.indexOf(prefix);
// If anywhere else, consider the line a command
final var newLineIndex = comment.indexOf('\n', index);
if (newLineIndex >= 0) {
command = comment.substring(index + prefix.length(), newLineIndex);
} else {
command = comment.substring(index + prefix.length());
if (comment.charAt(index) == '\n') {
// If anywhere else, consider the line a command
final var newLineIndex = comment.indexOf('\n', index);
if (newLineIndex >= 0) {
command = comment.substring(index + prefix.length(), newLineIndex);
} else {
command = comment.substring(index + prefix.length());
}
}
}

Expand Down

0 comments on commit 5f7625d

Please sign in to comment.