ソースを参照

调整左右压缩次序

James 5 年 前
コミット
1fcb5c801c
1 ファイル変更5 行追加5 行削除
  1. 5 5
      src/main/java/com/jfinal/template/stat/Compressor.java

+ 5 - 5
src/main/java/com/jfinal/template/stat/Compressor.java

@@ -59,11 +59,6 @@ public class Compressor {
 	 * @param result 存放压缩结果
 	 */
 	protected void compressLine(StringBuilder content, int start, int end, boolean compressLeft, StringBuilder result) {
-		// 压缩右侧空白
-		while (end >= start && content.charAt(end) <= ' ') {
-			end--;
-		}
-		
 		// 压缩左侧空白
 		if (compressLeft) {
 			while (start < end && content.charAt(start) <= ' ') {
@@ -71,6 +66,11 @@ public class Compressor {
 			}
 		}
 		
+		// 压缩右侧空白
+		while (end >= start && content.charAt(end) <= ' ') {
+			end--;
+		}
+		
 		if (start <= end) {
 			for (int i = start; i <= end; i++) {
 				result.append(content.charAt(i));