Browse Source

* Allow indent to work

michael 6 years ago
parent
commit
46f7c2d5dc
1 changed files with 8 additions and 5 deletions
  1. 8 5
      packages/rtl/browserconsole.pas

+ 8 - 5
packages/rtl/browserconsole.pas

@@ -5,7 +5,7 @@ unit browserconsole;
 interface
 interface
 
 
 uses
 uses
-  js,web;
+  js,web, sysutils;
 
 
 Const
 Const
   BrowserLineBreak = #10;
   BrowserLineBreak = #10;
@@ -84,14 +84,17 @@ Var
   CL: String;
   CL: String;
 
 
 begin
 begin
-  // Maybe add some way to limit line length
-  CL:=LastLine.InnerText;
+  CL:=LastLine.InnerHtml;
   CL:=CL+String(S);
   CL:=CL+String(S);
-  LastLine.InnerText:=CL;
+  cl:=StringReplace(cl,' ',' ',[rfReplaceAll]);
+  cl:=StringReplace(cl,#13#10,'<br>',[rfReplaceAll]);
+  cl:=StringReplace(cl,#10,'<br>',[rfReplaceAll]);
+  cl:=StringReplace(cl,#10,'<br>',[rfReplaceAll]);
+  LastLine.InnerHtml:=CL;
   if NewLine then
   if NewLine then
     begin
     begin
     if ConsoleLinesToBrowserLog then
     if ConsoleLinesToBrowserLog then
-      console.log(CL);
+      console.log(LastLine.InnerText);
     AppendLine;
     AppendLine;
     end;
     end;
 end;
 end;