diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-08-17 21:18:22 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-08-17 21:23:24 -0700 |
commit | 2381f7b43f5fb9474dea984ae0b02f56ca2030cf (patch) | |
tree | 0347ba7b9518eabacd28625971ab4f515e19520e | |
parent | 1221fde164c47480f3c30209ad5167e4a005769a (diff) | |
download | view.love-2381f7b43f5fb9474dea984ae0b02f56ca2030cf.tar.gz |
simpler location comparison
-rw-r--r-- | select.lua | 7 |
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 |