aboutsummaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-11-19 18:45:10 +0100
committerbptato <nincsnevem662@gmail.com>2022-11-19 18:45:10 +0100
commit941f7e43b5cb7ebf6b84c3fb758ef2f1a5f641a3 (patch)
tree3e36c52d3cb8c87751b45128a3180237a3825d74 /src/display
parent986522a915233dc068e00b47ca8b16e42cb50c7f (diff)
downloadchawan-941f7e43b5cb7ebf6b84c3fb758ef2f1a5f641a3.tar.gz
Fix weird screen shift behavior
(or at least I hope this fixed it)
Diffstat (limited to 'src/display')
-rw-r--r--src/display/client.nim5
-rw-r--r--src/display/pager.nim13
2 files changed, 10 insertions, 8 deletions
diff --git a/src/display/client.nim b/src/display/client.nim
index a45e64e3..cf5842b1 100644
--- a/src/display/client.nim
+++ b/src/display/client.nim
@@ -208,10 +208,11 @@ proc inputLoop(client: Client) =
for msg in client.pager.status:
eprint msg
client.quit(1)
- if client.pager.lineedit.isNone and client.pager.switched:
+ if client.pager.lineedit.isNone and client.pager.redraw or client.pager.container.redraw:
client.pager.refreshDisplay(client.pager.container)
client.pager.displayPage()
- client.pager.switched = false
+ client.pager.redraw = false
+ client.pager.container.redraw = false
if client.pager.command != "":
client.command(client.pager.command)
client.pager.command = ""
diff --git a/src/display/pager.nim b/src/display/pager.nim
index e34d94eb..f8e012eb 100644
--- a/src/display/pager.nim
+++ b/src/display/pager.nim
@@ -38,7 +38,6 @@ type
reverseSearch: bool
status*: seq[string]
statusmsg*: FixedGrid
- switched*: bool
tty: File
selector*: Selector[Container]
fdmap*: Table[FileHandle, Container]
@@ -46,6 +45,7 @@ type
display: FixedGrid
bheight*: int
bwidth*: int
+ redraw*: bool
iterator containers*(pager: Pager): Container =
if pager.container != nil:
@@ -60,7 +60,7 @@ iterator containers*(pager: Pager): Container =
proc setContainer*(pager: Pager, c: Container) =
pager.container = c
- pager.switched = true
+ pager.redraw = true
proc cursorDown(pager: Pager) {.jsfunc.} = pager.container.cursorDown()
proc cursorUp(pager: Pager) {.jsfunc.} = pager.container.cursorUp()
@@ -283,6 +283,9 @@ proc displayPage*(pager: Pager) =
stdout.flushFile()
proc redraw(pager: Pager) {.jsfunc.} =
+ pager.redraw = true
+
+proc draw*(pager: Pager) =
pager.refreshDisplay()
pager.refreshStatusMsg()
pager.displayPage()
@@ -491,7 +494,7 @@ proc updateReadLineISearch(pager: Pager, linemode: LineMode) =
pager.regex = pager.iregex
pager.reverseSearch = linemode == ISEARCH_B
pager.container.clearSearchHighlights()
- pager.redraw()
+ pager.redraw = true
proc updateReadLine*(pager: Pager) =
let lineedit = pager.lineedit.get
@@ -600,9 +603,7 @@ proc handleEvent*(pager: Pager, container: Container): bool =
pager.displayCursor()
of UPDATE:
if container == pager.container:
- pager.refreshDisplay()
- pager.refreshStatusMsg()
- pager.displayPage()
+ pager.redraw = true
of JUMP:
if container == pager.container:
pager.refreshStatusMsg()