about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-07-08 14:18:23 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-07-08 14:18:23 -0700
commit8efdb898c6092e070900ae8ce13fb31ab321d5f8 (patch)
tree502080afff94c1c20302fa79518df78f443617f4
parent6667c37066db79f1bc9738f46aef2f09ccaea03e (diff)
downloadview.love-8efdb898c6092e070900ae8ce13fb31ab321d5f8.tar.gz
rename a couple of variables
-rw-r--r--text.lua20
1 files changed, 10 insertions, 10 deletions
diff --git a/text.lua b/text.lua
index e8fa723..d0eab42 100644
--- a/text.lua
+++ b/text.lua
@@ -749,17 +749,17 @@ function Text.nearest_cursor_pos(line, x)  -- x includes left margin
   if x > max_x then
     return len+1
   end
-  local left, right = 1, len+1
+  local leftpos, rightpos = 1, len+1
 --?   print('-- nearest', x)
   while true do
---?     print('nearest', x, '^'..line..'$', left, right)
-    if left == right then
-      return left
+--?     print('nearest', x, '^'..line..'$', leftpos, rightpos)
+    if leftpos == rightpos then
+      return leftpos
     end
-    local curr = math.floor((left+right)/2)
+    local curr = math.floor((leftpos+rightpos)/2)
     local currxmin = Margin_left+Text.x(line, curr)
     local currxmax = Margin_left+Text.x(line, curr+1)
---?     print('nearest', x, left, right, curr, currxmin, currxmax)
+--?     print('nearest', x, leftpos, rightpos, curr, currxmin, currxmax)
     if currxmin <= x and x < currxmax then
       if x-currxmin < currxmax-x then
         return curr
@@ -767,13 +767,13 @@ function Text.nearest_cursor_pos(line, x)  -- x includes left margin
         return curr+1
       end
     end
-    if left >= right-1 then
-      return right
+    if leftpos >= rightpos-1 then
+      return rightpos
     end
     if currxmin > x then
-      right = curr
+      rightpos = curr
     else
-      left = curr
+      leftpos = curr
     end
   end
   assert(false)