diff options
author | bptato <nincsnevem662@gmail.com> | 2024-03-01 15:31:04 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-03-01 15:31:04 +0100 |
commit | 28a760d7823fcb53de26dceeda376a74ce1cd88a (patch) | |
tree | 070d307fd1adf2d6e9433a24c34e828f399c02e2 /src/local | |
parent | e0574a00c2c001671be825e55fecb741238b438b (diff) | |
download | chawan-28a760d7823fcb53de26dceeda376a74ce1cd88a.tar.gz |
container: fix cursorLineBegin/cursorLineTextStart with vertical scroll
setCursorX only moves the screen backwards if the intended X position is lower than the actual X position. Pass it -1 so that this is true even with zero-width lines.
Diffstat (limited to 'src/local')
-rw-r--r-- | src/local/container.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/local/container.nim b/src/local/container.nim index 5d5e6669..dfda1f49 100644 --- a/src/local/container.nim +++ b/src/local/container.nim @@ -614,6 +614,8 @@ proc cursorLineTextStart(container: Container) {.jsfunc.} = if not r.isWhitespace(): break x += r.twidth(x) + if x == 0: + dec x container.setCursorX(x) # zb @@ -711,7 +713,7 @@ proc cursorRight(container: Container, n = 1) {.jsfunc.} = container.setCursorX(container.cursorLastX() + n) proc cursorLineBegin(container: Container) {.jsfunc.} = - container.setCursorX(0) + container.setCursorX(-1) proc cursorLineEnd(container: Container) {.jsfunc.} = container.setCursorX(container.currentLineWidth() - 1) |