about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buffer/container.nim4
-rw-r--r--src/display/pager.nim3
2 files changed, 4 insertions, 3 deletions
diff --git a/src/buffer/container.nim b/src/buffer/container.nim
index 9fdc0a69..04900474 100644
--- a/src/buffer/container.nim
+++ b/src/buffer/container.nim
@@ -905,7 +905,7 @@ proc onreadline(container: Container, w: Slice[int], handle: (proc(line: SimpleF
     handle(line)
   if res.numLines > w.b + 1:
     var w = w
-    w.a = w.b
+    w.a += 24
     w.b += 24
     container.iface.getLines(w).then(proc(res: GetLinesResult) =
       container.onreadline(w, handle, res))
@@ -916,7 +916,7 @@ proc onreadline(container: Container, w: Slice[int], handle: (proc(line: SimpleF
 proc readLines*(container: Container, handle: (proc(line: SimpleFlexibleLine))) =
   if container.code == 0:
     # load succeded
-    let w = 0 .. 24
+    let w = 0 .. 23
     container.iface.getLines(w).then(proc(res: GetLinesResult) =
       container.onreadline(w, handle, res))
     while container.iface.hasPromises:
diff --git a/src/display/pager.nim b/src/display/pager.nim
index 45386376..95057978 100644
--- a/src/display/pager.nim
+++ b/src/display/pager.nim
@@ -302,7 +302,8 @@ proc drawBuffer*(pager: Pager, container: Container, ostream: Stream) =
           x += r.width()
         s &= pager.term.processOutputString(outstr, w)
         s &= pager.term.processFormat(format, f.format)
-      s &= pager.term.processOutputString(line.str.substr(i), w)
+      if i < line.str.len:
+        s &= pager.term.processOutputString(line.str.substr(i), w)
       s &= pager.term.processFormat(format, newFormat()) & "\n"
       ostream.write(s))
   ostream.flush()