about summary refs log tree commit diff stats
path: root/src/io/buffer.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-07-30 13:20:26 +0200
committerbptato <nincsnevem662@gmail.com>2022-07-30 13:20:26 +0200
commitf08b26d932d57e76a01e800371a27275961419d2 (patch)
treef5aaf3476b61a1b7a70f42b04ebee63e422abdc2 /src/io/buffer.nim
parentca81bbcecd3777e8b20e12332ef813b874dd7fa5 (diff)
downloadchawan-f08b26d932d57e76a01e800371a27275961419d2.tar.gz
Enable raw mode during rendering
So that non-processed characters aren't displayed on the screen
Diffstat (limited to 'src/io/buffer.nim')
-rw-r--r--src/io/buffer.nim11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/io/buffer.nim b/src/io/buffer.nim
index 7bc181a5..5652e84c 100644
--- a/src/io/buffer.nim
+++ b/src/io/buffer.nim
@@ -93,7 +93,7 @@ func generateFullOutput(buffer: Buffer): string =
   for cell in buffer.display:
     if x >= buffer.width:
       result &= EL()
-      result &= '\n'
+      result &= "\r\n"
       x = 0
       w = 0
 
@@ -104,7 +104,7 @@ func generateFullOutput(buffer: Buffer): string =
     inc x
 
   result &= EL()
-  result &= '\n'
+  result &= "\r\n"
 
 # generate a sequence of instructions to replace the previous frame with the
 # current one. ideally should be used when small changes are made (e.g. hover
@@ -1178,13 +1178,14 @@ proc drawBuffer*(buffer: Buffer) =
   var format = newFormat()
   for line in buffer.lines:
     if line.formats.len == 0:
-      print(line.str & '\n')
+      print(line.str & "\r\n")
     else:
       var x = 0
       var i = 0
       for f in line.formats:
         var outstr = ""
-        assert f.pos < line.str.width(), "fpos " & $f.pos & "\nstr" & line.str & "\n"
+        #TODO TODO TODO renderhtml has broken format outputting
+        #assert f.pos < line.str.width(), "fpos " & $f.pos & "\nstr" & line.str & "\n"
         while x < f.pos:
           var r: Rune
           fastRuneAt(line.str, i, r)
@@ -1194,7 +1195,7 @@ proc drawBuffer*(buffer: Buffer) =
         print(format.processFormat(f.format))
       print(line.str.substr(i))
       print(format.processFormat(newFormat()))
-      print('\n')
+      print("\r\n")
 
 proc refreshBuffer*(buffer: Buffer, peek = false) =
   buffer.title = buffer.getTitle()