about summary refs log tree commit diff stats
path: root/src/io/buffer.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-01-25 22:30:52 +0100
committerbptato <nincsnevem662@gmail.com>2022-01-25 22:38:08 +0100
commit0cdcb6b2646e6753b99e66a974040fc6d71d7dfd (patch)
tree64e115f99c9aaf69aded03c112881e68db042cd3 /src/io/buffer.nim
parentaaf1ff614298a64cf0be1adf1a3d5d28882318e7 (diff)
downloadchawan-0cdcb6b2646e6753b99e66a974040fc6d71d7dfd.tar.gz
Add some command line fixes, fix related bugs
Diffstat (limited to 'src/io/buffer.nim')
-rw-r--r--src/io/buffer.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/io/buffer.nim b/src/io/buffer.nim
index 370e8209..67859b4a 100644
--- a/src/io/buffer.nim
+++ b/src/io/buffer.nim
@@ -318,7 +318,9 @@ proc refreshDisplay(buffer: Buffer) =
     inc y
 
 proc setCursorXB(buffer: Buffer, byte: int) =
+  assert byte < buffer.currentLine.len
   var b = buffer.currentCursorBytes()
+  assert b < buffer.currentLine.len, $buffer.cursory & " " & $b & " " & $buffer.currentLine.len
   var w = buffer.fromx + buffer.cursorx
   if b < byte:
     while b < byte:
@@ -794,7 +796,7 @@ proc setStatusMessage*(buffer: Buffer, str: string) =
   buffer.nostatus = true
 
 proc lineInfo*(buffer: Buffer) =
-    buffer.setStatusMessage("line " & $(buffer.cursory + 1) & "/" & $buffer.numLines & " col " & $(buffer.cursorx + 1) & "/" & $buffer.currentLineWidth() & " cell width: " & $buffer.currentDisplayCell().width())
+    buffer.setStatusMessage("line " & $(buffer.cursory + 1) & "/" & $buffer.numLines & " col " & $(buffer.cursorx + 1) & "/" & $buffer.currentLineWidth() & " x: " & $buffer.currentCursorBytes())
 
 proc displayBufferSwapOutput(buffer: Buffer) =
   print(buffer.generateSwapOutput())