about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-08-17 21:25:44 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-08-17 21:25:44 -0700
commit6d3c059964251b479cbeea663f77ef1d377bef96 (patch)
tree2709b82cad130d916f85de31b98e724ab41984fe
parent2923ef3f492cfc453607327f72e3e60fca566f5e (diff)
parent2381f7b43f5fb9474dea984ae0b02f56ca2030cf (diff)
downloadtext.love-6d3c059964251b479cbeea663f77ef1d377bef96.tar.gz
Merge lines.love
-rw-r--r--select.lua7
1 files changed, 2 insertions, 5 deletions
diff --git a/select.lua b/select.lua
index 91f7890..60614f8 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