about summary refs log tree commit diff stats
path: root/src/local
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-01 15:31:04 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-01 15:31:04 +0100
commit28a760d7823fcb53de26dceeda376a74ce1cd88a (patch)
tree070d307fd1adf2d6e9433a24c34e828f399c02e2 /src/local
parente0574a00c2c001671be825e55fecb741238b438b (diff)
downloadchawan-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.nim4
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)