about summary refs log tree commit diff stats
path: root/select.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-08-17 21:18:22 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-08-17 21:23:24 -0700
commit2381f7b43f5fb9474dea984ae0b02f56ca2030cf (patch)
tree0347ba7b9518eabacd28625971ab4f515e19520e /select.lua
parent1221fde164c47480f3c30209ad5167e4a005769a (diff)
downloadlines.love-2381f7b43f5fb9474dea984ae0b02f56ca2030cf.tar.gz
simpler location comparison
Diffstat (limited to 'select.lua')
-rw-r--r--select.lua7
1 files changed, 2 insertions, 5 deletions
diff --git a/select.lua b/select.lua
index b08bb87..c5794e1 100644
--- a/select.lua
+++ b/select.lua
@@ -16,13 +16,10 @@ function Text.clip_selection(State, line_index, apos, bpos)
   else
     maxl,maxp = State.cursor1.line,State.cursor1.pos
   end
-  if minl > maxl then
+  if Text.lt1({line=maxl, pos=maxp},
+              {line=minl, pos=minp}) then
     minl,maxl = maxl,minl
     minp,maxp = maxp,minp
-  elseif minl == maxl then
-    if minp > maxp then
-      minp,maxp = maxp,minp
-    end
   end
   -- check if intervals are disjoint
   if line_index < minl then return nil,nil end