From 2381f7b43f5fb9474dea984ae0b02f56ca2030cf Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 17 Aug 2022 21:18:22 -0700 Subject: simpler location comparison --- select.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'select.lua') 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 -- cgit 1.4.1-2-gfad0