Skip to content

Commit

Permalink
Less fails with PatternSyntaxException #609
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Dec 1, 2020
1 parent b1a17cb commit 764a6a6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions builtins/src/main/java/org/jline/builtins/Nano.java
Original file line number Diff line number Diff line change
Expand Up @@ -1815,13 +1815,20 @@ protected static List<String> split(String s) {
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '"') {
depth = depth == 0 ? 1 : 0;
} else if (c ==' ' && depth == 0 && sb.length() > 0) {
if (depth == 0) {
depth = 1;
} else {
char nextChar = i < s.length() - 1 ? s.charAt(i + 1) : ' ';
if (nextChar == ' ') {
depth = 0;
}
}
} else if (c == ' ' && depth == 0 && sb.length() > 0) {
out.add(stripQuotes(sb.toString()));
sb = new StringBuilder();
continue;
}
if (sb.length() > 0 || (c!=' ' && c!='\t')) {
if (sb.length() > 0 || (c != ' ' && c != '\t')) {
sb.append(c);
}
}
Expand Down

0 comments on commit 764a6a6

Please sign in to comment.