diff options
author | bptato <nincsnevem662@gmail.com> | 2022-12-01 09:21:21 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-12-01 09:21:21 +0100 |
commit | 81f800cb813d36d5339a3ab17938e0afa2089899 (patch) | |
tree | 03d04e679acccb54f147893adf3ef3a72d68b341 /src/display | |
parent | b1794c0961a5efb30a0dafa34845bedf49261819 (diff) | |
download | chawan-81f800cb813d36d5339a3ab17938e0afa2089899.tar.gz |
Make redraw() actually clear the screen
It's more useful this way.
Diffstat (limited to 'src/display')
-rw-r--r-- | src/display/pager.nim | 2 | ||||
-rw-r--r-- | src/display/term.nim | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/display/pager.nim b/src/display/pager.nim index eedcc477..e8777456 100644 --- a/src/display/pager.nim +++ b/src/display/pager.nim @@ -284,6 +284,7 @@ proc drawBuffer*(pager: Pager, container: Container, ostream: Stream) = proc redraw(pager: Pager) {.jsfunc.} = pager.redraw = true + pager.term.clearCanvas() proc draw*(pager: Pager) = pager.term.hideCursor() @@ -648,6 +649,7 @@ proc handleEvent0(pager: Pager, container: Container, event: ContainerEvent): bo of UPDATE: if container == pager.container: pager.redraw = true + if event.force: pager.term.clearCanvas() of READ_LINE: if container == pager.container: pager.setLineEdit("(BUFFER) " & event.prompt, BUFFER, event.value, hide = event.password) diff --git a/src/display/term.nim b/src/display/term.nim index 0ab82367..899cd561 100644 --- a/src/display/term.nim +++ b/src/display/term.nim @@ -346,6 +346,9 @@ proc outputGrid*(term: Terminal) = term.outfile.write(term.generateSwapOutput(term.canvas, term.pcanvas)) term.pcanvas = term.canvas +proc clearCanvas*(term: Terminal) = + term.cleared = false + when defined(posix): import posix import termios |