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2TR5A2ITA6JJT2QC
3XD6M3CFKZJR365MHXUWJ4HGSDTPYO6WYZ4RGW7ECBBITKVQX24QC
elseif lines.current then
if lines.current.pending then
if lines.current.pending.mode == 'freehand' then
elseif Lines.current then
if Lines.current.pending then
if Lines.current.pending.mode == 'freehand' then
table.insert(lines.current.shapes, lines.current.pending)
elseif lines.current.pending.mode == 'line' then
local mx,my = coord(x-16), coord(y-lines.current.y)
if mx >= 0 and mx < 256 and my >= 0 and my < lines.current.h then
local j = insert_point(lines.current.points, mx,my)
lines.current.pending.p2 = j
table.insert(lines.current.shapes, lines.current.pending)
table.insert(Lines.current.shapes, Lines.current.pending)
elseif Lines.current.pending.mode == 'line' then
local mx,my = coord(x-16), coord(y-Lines.current.y)
if mx >= 0 and mx < 256 and my >= 0 and my < Lines.current.h then
local j = insert_point(Lines.current.points, mx,my)
Lines.current.pending.p2 = j
table.insert(Lines.current.shapes, Lines.current.pending)
elseif lines.current.pending.mode == 'manhattan' then
local p1 = lines.current.points[lines.current.pending.p1]
local mx,my = coord(x-16), coord(y-lines.current.y)
if mx >= 0 and mx < 256 and my >= 0 and my < lines.current.h then
elseif Lines.current.pending.mode == 'manhattan' then
local p1 = Lines.current.points[Lines.current.pending.p1]
local mx,my = coord(x-16), coord(y-Lines.current.y)
if mx >= 0 and mx < 256 and my >= 0 and my < Lines.current.h then
local p2 = lines.current.points[lines.current.pending.p2]
love.mouse.setPosition(16+pixels(p2.x), lines.current.y+pixels(p2.y))
table.insert(lines.current.shapes, lines.current.pending)
local p2 = Lines.current.points[Lines.current.pending.p2]
love.mouse.setPosition(16+pixels(p2.x), Lines.current.y+pixels(p2.y))
table.insert(Lines.current.shapes, Lines.current.pending)
elseif lines.current.pending.mode == 'polygon' then
local mx,my = coord(x-16), coord(y-lines.current.y)
if mx >= 0 and mx < 256 and my >= 0 and my < lines.current.h then
local j = insert_point(lines.current.points, mx,my)
table.insert(lines.current.shapes, lines.current.pending)
elseif Lines.current.pending.mode == 'polygon' then
local mx,my = coord(x-16), coord(y-Lines.current.y)
if mx >= 0 and mx < 256 and my >= 0 and my < Lines.current.h then
local j = insert_point(Lines.current.points, mx,my)
table.insert(Lines.current.shapes, Lines.current.pending)
table.insert(lines.current.shapes, lines.current.pending)
elseif lines.current.pending.mode == 'circle' then
local mx,my = coord(x-16), coord(y-lines.current.y)
if mx >= 0 and mx < 256 and my >= 0 and my < lines.current.h then
local center = lines.current.points[lines.current.pending.center]
lines.current.pending.radius = math.dist(center.x,center.y, mx,my)
table.insert(lines.current.shapes, lines.current.pending)
table.insert(Lines.current.shapes, Lines.current.pending)
elseif Lines.current.pending.mode == 'circle' then
local mx,my = coord(x-16), coord(y-Lines.current.y)
if mx >= 0 and mx < 256 and my >= 0 and my < Lines.current.h then
local center = Lines.current.points[Lines.current.pending.center]
Lines.current.pending.radius = math.dist(center.x,center.y, mx,my)
table.insert(Lines.current.shapes, Lines.current.pending)
elseif lines.current.pending.mode == 'arc' then
local mx,my = coord(x-16), coord(y-lines.current.y)
if mx >= 0 and mx < 256 and my >= 0 and my < lines.current.h then
local center = lines.current.points[lines.current.pending.center]
lines.current.pending.end_angle = angle_with_hint(center.x,center.y, mx,my, lines.current.pending.end_angle)
table.insert(lines.current.shapes, lines.current.pending)
elseif Lines.current.pending.mode == 'arc' then
local mx,my = coord(x-16), coord(y-Lines.current.y)
if mx >= 0 and mx < 256 and my >= 0 and my < Lines.current.h then
local center = Lines.current.points[Lines.current.pending.center]
Lines.current.pending.end_angle = angle_with_hint(center.x,center.y, mx,my, Lines.current.pending.end_angle)
table.insert(Lines.current.shapes, Lines.current.pending)
lines[cursor_line].data = string.sub(lines[cursor_line].data, 1, byteoffset)..t..string.sub(lines[cursor_line].data, byteoffset+1)
Lines[cursor_line].data = string.sub(Lines[cursor_line].data, 1, byteoffset)..t..string.sub(Lines[cursor_line].data, byteoffset+1)
local byte_start = utf8.offset(lines[cursor_line].data, cursor_pos-1)
local byte_end = utf8.offset(lines[cursor_line].data, cursor_pos)
local byte_start = utf8.offset(Lines[cursor_line].data, cursor_pos-1)
local byte_end = utf8.offset(Lines[cursor_line].data, cursor_pos)
-- join lines
cursor_pos = utf8.len(lines[cursor_line-1].data)+1
lines[cursor_line-1].data = lines[cursor_line-1].data..lines[cursor_line].data
table.remove(lines, cursor_line)
-- join Lines
cursor_pos = utf8.len(Lines[cursor_line-1].data)+1
Lines[cursor_line-1].data = Lines[cursor_line-1].data..Lines[cursor_line].data
table.remove(Lines, cursor_line)
if cursor_pos <= #lines[cursor_line].data then
local byte_start = utf8.offset(lines[cursor_line].data, cursor_pos)
local byte_end = utf8.offset(lines[cursor_line].data, cursor_pos+1)
if cursor_pos <= #Lines[cursor_line].data then
local byte_start = utf8.offset(Lines[cursor_line].data, cursor_pos)
local byte_end = utf8.offset(Lines[cursor_line].data, cursor_pos+1)