Explorar o código

修复脚本中包含文本块格式化代码时结果不正确的问题

mxd %!s(int64=3) %!d(string=hai) anos
pai
achega
91ac8301ab

+ 3 - 1
magic-editor/src/console/src/scripts/beautifier/core/output.js

@@ -310,7 +310,9 @@ Output.prototype.get_code = function(eol) {
 
   var sweet_code = this.__lines.join('\n');
 
-  if (eol !== '\n') {
+  if (eol === '\r\n') {
+    sweet_code = sweet_code.replaceAll(/([^\r])\n/g, `$1${eol}`);
+  }else if (eol !== '\n') {
     sweet_code = sweet_code.replace(/[\n]/g, eol);
   }
   return sweet_code;