about summary refs log tree commit diff stats
path: root/src/io
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2021-12-05 20:02:02 +0100
committerbptato <nincsnevem662@gmail.com>2021-12-05 20:02:02 +0100
commit458f713fd4e506df0b916bb436c2d19fc6557e02 (patch)
tree25bde336b7834e3d9f89ddaa9f750294580c05d9 /src/io
parent31117cad22df103f84cfbe97dff08debcde72a66 (diff)
downloadchawan-458f713fd4e506df0b916bb436c2d19fc6557e02.tar.gz
Avoid negative fromx
Diffstat (limited to 'src/io')
-rw-r--r--src/io/buffer.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/io/buffer.nim b/src/io/buffer.nim
index 18e4a3d6..893f66a9 100644
--- a/src/io/buffer.nim
+++ b/src/io/buffer.nim
@@ -350,7 +350,7 @@ proc cursorLeft*(buffer: Buffer) =
   elif buffer.cursorx > 0:
     buffer.cursorx = max(0, cellorigin - 1)
     if buffer.fromx > buffer.cursorx - (buffer.cell().ow - 1):
-      buffer.fromx = buffer.cursorx - max(0, buffer.cell().ow - 1)
+      buffer.fromx = max(buffer.cursorx - max(0, buffer.cell().ow - 1), 0)
       buffer.redraw = true
 
   buffer.xend = buffer.cursorx