1
0
mirror of https://github.com/LDDestroier/CC/ synced 2024-06-17 02:40:02 +00:00

Fixed crash when starting selection on empty area

This commit is contained in:
LDDestroier 2019-10-13 01:35:45 -04:00 committed by GitHub
parent 03b97bc087
commit 4d8c07d6b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -707,6 +707,7 @@ prompt = function(prebuffer, precy, maxY, _eldit)
local yAdj = 0
for id,sel in pairs(eldit.selections) do
for y = sel[1].y, sel[2].y do
if eldit.buffer[y] then
xAdjusts[y] = xAdjusts[y] or {}
if checkWithinArea(#eldit.buffer[y] + 1, y, sel[1].x, sel[1].y, sel[2].x, sel[2].y) then
yAdj = yAdj + 1
@ -720,8 +721,10 @@ prompt = function(prebuffer, precy, maxY, _eldit)
end
end
end
end
for id,sel in pairs(eldit.selections) do
for y = sel[2].y, sel[1].y, -1 do
if eldit.buffer[y] then
for x = #eldit.buffer[y] + 1, 1, -1 do
if checkWithinArea(x, y, sel[1].x, sel[1].y, sel[2].x, sel[2].y) then
if x == #eldit.buffer[y] + 1 then
@ -738,6 +741,7 @@ prompt = function(prebuffer, precy, maxY, _eldit)
end
end
end
end
eldit.selections = {}
adjustCursor(0, 0, true)
return xAdjusts, yAdjusts