diff options
author | bptato <nincsnevem662@gmail.com> | 2022-12-15 21:02:59 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-12-15 21:02:59 +0100 |
commit | 609e628a39043179c937a20ab5a1dbd0505be5ea (patch) | |
tree | 984e350270108ae4148bb1b5aaa631dd374e3070 /src/display | |
parent | 5d8500c7169c60fe2ba3ee62f64514a65608d2c7 (diff) | |
download | chawan-609e628a39043179c937a20ab5a1dbd0505be5ea.tar.gz |
container: do not load all lines at once in readLines
Diffstat (limited to 'src/display')
-rw-r--r-- | src/display/pager.nim | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/display/pager.nim b/src/display/pager.nim index 1a372afd..9bce0e48 100644 --- a/src/display/pager.nim +++ b/src/display/pager.nim @@ -285,8 +285,7 @@ proc refreshStatusMsg*(pager: Pager) = proc drawBuffer*(pager: Pager, container: Container, ostream: Stream) = var format = newFormat() - var i = 0 - for line in container.readLines: + container.readLines(proc(line: SimpleFlexibleLine) = if line.formats.len == 0: ostream.write(line.str & "\n") else: @@ -303,8 +302,7 @@ proc drawBuffer*(pager: Pager, container: Container, ostream: Stream) = s &= outstr s &= pager.term.processFormat(format, f.format) s &= line.str.substr(i) & pager.term.processFormat(format, newFormat()) & "\n" - ostream.write(s) - inc i + ostream.write(s)) ostream.flush() proc redraw(pager: Pager) {.jsfunc.} = |