CG3264MMJTTSCJWUA2EMTBOPTDB2NZIJ7XICKHWUTZ4UWLFP7POAC
G6OYAYHUSMSPKLRW52LQDAF4NBHFPWY3GZAHZZDLJY2ZL6NLTNEQC
XNFTJHC4QSHNSIWNN7K6QZEZ37GTQYKHS4EPNSVPQCUSWREROGIQC
BULPIBEGL7TMK6CVIE7IS7WGAHGOSUJBGJSFQK542MOWGHP2ADQQC
KECEMMMRW2VVBZ567HJQPGLC57LTSBKWH7UFP32IW43D23X6WTEQC
2HW3HUCGWNPSVN2BRPZIFVBI64CTFEJKETLVDJ4X5X2GUPERXSJQC
2RXZ3PGOTTZ6M4R372JXIKPLBQKPVBMAXNPIEO2HZDN4EMYW4GNAC
elseif chord == 'left' then
Text.left()
elseif chord == 'right' then
Text.right()
-- left/right by one word
-- C- hotkeys reserved for drawings, so we'll use M-
elseif chord == 'M-left' then
while true do
Text.left()
if Cursor1.pos == 1 then break end
assert(Cursor1.pos > 1)
local offset = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos)
assert(offset > 1)
if Lines[Cursor1.line].data:sub(offset-1,offset-1) == ' ' then
break
end
end
elseif chord == 'M-right' then
while true do
Text.right()
if Cursor1.pos > utf8.len(Lines[Cursor1.line].data) then break end
local offset = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos)
if Lines[Cursor1.line].data:sub(offset,offset) == ' ' then
break
end
end
-- paste
elseif chord == 'M-v' then
local s = love.system.getClipboardText()
for _,code in utf8.codes(s) do
Text.insert_at_cursor(utf8.char(code))
end
elseif chord == 'home' then
Cursor1.pos = 1
elseif chord == 'end' then
Cursor1.pos = utf8.len(Lines[Cursor1.line].data) + 1
-- paste
elseif chord == 'M-v' then
local s = love.system.getClipboardText()
for _,code in utf8.codes(s) do
Text.insert_at_cursor(utf8.char(code))
end
--== shortcuts that move the cursor
elseif chord == 'left' then
Text.left()
elseif chord == 'right' then
Text.right()
-- left/right by one word
-- C- hotkeys reserved for drawings, so we'll use M-
elseif chord == 'M-left' then
while true do
Text.left()
if Cursor1.pos == 1 then break end
assert(Cursor1.pos > 1)
local offset = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos)
assert(offset > 1)
if Lines[Cursor1.line].data:sub(offset-1,offset-1) == ' ' then
break
end
end
elseif chord == 'M-right' then
while true do
Text.right()
if Cursor1.pos > utf8.len(Lines[Cursor1.line].data) then break end
local offset = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos)
if Lines[Cursor1.line].data:sub(offset,offset) == ' ' then
break
end
end
elseif chord == 'home' then
Cursor1.pos = 1
elseif chord == 'end' then
Cursor1.pos = utf8.len(Lines[Cursor1.line].data) + 1