about summary refs log tree commit diff stats
path: root/src/local
diff options
context:
space:
mode:
Diffstat (limited to 'src/local')
-rw-r--r--src/local/container.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/local/container.nim b/src/local/container.nim
index 21981049..011c7279 100644
--- a/src/local/container.nim
+++ b/src/local/container.nim
@@ -260,6 +260,7 @@ func cursorFirstX(container: Container): int =
     if w + tw > cc:
       return w
     w += tw
+  return w
 
 # Returns the X position of the last cell occupied by the character the cursor
 # currently points to.
@@ -513,8 +514,9 @@ proc setCursorX(container: Container, x: int, refresh = true, save = true)
     # target x is before the screen start
     if x2 < container.cursorx:
       # desired X position is lower than cursor X; move screen back to the
-      # desired position if valid, otherwise the last cell of the current line.
-      if x2 == x:
+      # desired position if valid, to 0 if the desired position is less than 0,
+      # otherwise the last cell of the current line.
+      if x2 <= x:
         container.setFromX(x, false)
       else:
         container.setFromX(cw - 1, false)