From 28a760d7823fcb53de26dceeda376a74ce1cd88a Mon Sep 17 00:00:00 2001 From: bptato Date: Fri, 1 Mar 2024 15:31:04 +0100 Subject: 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. --- src/local/container.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/local') 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) -- cgit 1.4.1-2-gfad0