diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/display/term.nim | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/display/term.nim b/src/display/term.nim index 1a3b8b9e..dd01d2b4 100644 --- a/src/display/term.nim +++ b/src/display/term.nim @@ -433,12 +433,18 @@ proc outputGrid*(term: Terminal) = if term.config.termreload: term.applyConfig() term.outfile.write(term.resetFormat()) - if term.config.forceclear or not term.cleared: + let samesize = term.canvas.width == term.pcanvas.width and term.canvas.height == term.pcanvas.height + if term.config.forceclear or not term.cleared or not samesize: term.outfile.write(term.generateFullOutput(term.canvas)) term.cleared = true else: term.outfile.write(term.generateSwapOutput(term.canvas, term.pcanvas)) - term.pcanvas = term.canvas + if not samesize: + term.pcanvas.width = term.canvas.width + term.pcanvas.height = term.canvas.height + term.pcanvas.cells.setLen(term.canvas.cells.len) + for i in 0 ..< term.canvas.cells.len: + term.pcanvas[i] = term.canvas[i] proc clearCanvas*(term: Terminal) = term.cleared = false |