mirror of
https://github.com/LDDestroier/CC/
synced 2024-06-17 10:49:58 +00:00
Fixed crash when starting selection on empty area
This commit is contained in:
parent
03b97bc087
commit
4d8c07d6b9
40
eldit.lua
40
eldit.lua
|
@ -707,32 +707,36 @@ prompt = function(prebuffer, precy, maxY, _eldit)
|
||||||
local yAdj = 0
|
local yAdj = 0
|
||||||
for id,sel in pairs(eldit.selections) do
|
for id,sel in pairs(eldit.selections) do
|
||||||
for y = sel[1].y, sel[2].y do
|
for y = sel[1].y, sel[2].y do
|
||||||
xAdjusts[y] = xAdjusts[y] or {}
|
if eldit.buffer[y] then
|
||||||
if checkWithinArea(#eldit.buffer[y] + 1, y, sel[1].x, sel[1].y, sel[2].x, sel[2].y) then
|
xAdjusts[y] = xAdjusts[y] or {}
|
||||||
yAdj = yAdj + 1
|
if checkWithinArea(#eldit.buffer[y] + 1, y, sel[1].x, sel[1].y, sel[2].x, sel[2].y) then
|
||||||
end
|
yAdj = yAdj + 1
|
||||||
yAdjusts[y + 1] = math.min(yAdjusts[y + 1] or math.huge, yAdj)
|
end
|
||||||
for x = 2, #eldit.buffer[y] do
|
yAdjusts[y + 1] = math.min(yAdjusts[y + 1] or math.huge, yAdj)
|
||||||
xAdjusts[y][x] = math.min(xAdjusts[y][x] or math.huge, xAdj)
|
for x = 2, #eldit.buffer[y] do
|
||||||
if checkWithinArea(x, y, sel[1].x, sel[1].y, sel[2].x, sel[2].y) then
|
xAdjusts[y][x] = math.min(xAdjusts[y][x] or math.huge, xAdj)
|
||||||
xAdj = xAdj + 1
|
if checkWithinArea(x, y, sel[1].x, sel[1].y, sel[2].x, sel[2].y) then
|
||||||
|
xAdj = xAdj + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for id,sel in pairs(eldit.selections) do
|
for id,sel in pairs(eldit.selections) do
|
||||||
for y = sel[2].y, sel[1].y, -1 do
|
for y = sel[2].y, sel[1].y, -1 do
|
||||||
for x = #eldit.buffer[y] + 1, 1, -1 do
|
if eldit.buffer[y] then
|
||||||
if checkWithinArea(x, y, sel[1].x, sel[1].y, sel[2].x, sel[2].y) then
|
for x = #eldit.buffer[y] + 1, 1, -1 do
|
||||||
if x == #eldit.buffer[y] + 1 then
|
if checkWithinArea(x, y, sel[1].x, sel[1].y, sel[2].x, sel[2].y) then
|
||||||
if eldit.buffer[y + 1] then
|
if x == #eldit.buffer[y] + 1 then
|
||||||
for i = 1, #eldit.buffer[y + 1] do
|
if eldit.buffer[y + 1] then
|
||||||
table.insert(eldit.buffer[y], eldit.buffer[y + 1][i])
|
for i = 1, #eldit.buffer[y + 1] do
|
||||||
|
table.insert(eldit.buffer[y], eldit.buffer[y + 1][i])
|
||||||
|
end
|
||||||
|
table.remove(eldit.buffer, y + 1)
|
||||||
end
|
end
|
||||||
table.remove(eldit.buffer, y + 1)
|
else
|
||||||
|
deleteText("single", nil, x, y)
|
||||||
end
|
end
|
||||||
else
|
|
||||||
deleteText("single", nil, x, y)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user