diff options
author | bptato <nincsnevem662@gmail.com> | 2023-09-30 19:42:41 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-09-30 19:42:41 +0200 |
commit | e26ea3aca2c0c5eb4a2678440dbec77105ee8dd4 (patch) | |
tree | dc48e835b9c39efd35486db785cda95206d0871d /src/local/container.nim | |
parent | 83857c03a64312770e0ba0f46b5917dceb23c0ad (diff) | |
download | chawan-e26ea3aca2c0c5eb4a2678440dbec77105ee8dd4.tar.gz |
buffer: fix cursor unnecessarily jumping to y=0
then() is called even if a nil Promise is returned, so an Opt is needed here.
Diffstat (limited to 'src/local/container.nim')
-rw-r--r-- | src/local/container.nim | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/local/container.nim b/src/local/container.nim index d3d0b879..6a11e02a 100644 --- a/src/local/container.nim +++ b/src/local/container.nim @@ -809,8 +809,9 @@ proc onload*(container: Container, res: LoadResult) = container.triggerEvent(LOADED) if not container.hasstart and container.source.location.anchor != "": return container.iface.gotoAnchor() - ).then(proc(res: tuple[x, y: int]) = - if res.x != -1 and res.y != -1: + ).then(proc(res: Opt[tuple[x, y: int]]) = + if res.isSome: + let res = res.get container.setCursorXY(res.x, res.y)) proc load(container: Container) = |