Pārlūkot izejas kodu

Changed tab to space conversion

Tabs are not always 4 spaces large. It completes the line to the 4th
character.
pull/1328/merge
Quentin pirms 8 gadiem
vecāks
revīzija
cafdb31692
1 mainītis faili ar 8 papildinājumiem un 1 dzēšanām
  1. 8
    1
      src/main/java/com/gitblit/utils/StringUtils.java

+ 8
- 1
src/main/java/com/gitblit/utils/StringUtils.java Parādīt failu

@@ -105,6 +105,8 @@ public class StringUtils {
public static String escapeForHtml(String inStr, boolean changeSpace, int tabLength) {
StringBuilder retStr = new StringBuilder();
int i = 0;
int l = 0;
while (i < inStr.length()) {
if (inStr.charAt(i) == '&') {
retStr.append("&amp;");
@@ -117,12 +119,17 @@ public class StringUtils {
} else if (changeSpace && inStr.charAt(i) == ' ') {
retStr.append("&nbsp;");
} else if (changeSpace && inStr.charAt(i) == '\t') {
for (int j = 0; j < tabLength; j++) {
for (int j = 0; j < tabLength - l; j++) {
retStr.append("&nbsp;");
}
l = -1;
} else {
retStr.append(inStr.charAt(i));
}
l = (l + 1) % tabLength;
if (inStr.charAt(i) == '\n')
l = 0;
i++;
}
return retStr.toString();

Notiek ielāde…
Atcelt
Saglabāt