Mouse stuff is pretty strenuous. For the first time I have to be careful not to recompute too often. And I ran into a race condition for the first time where resetting line.y within App.draw meant mouse clicks were extremely unlikely to see line.y set.
5FW7YOFTLKHRND6IOR4HG4X3C5BO2WV5KTEUW3PPKCRU5L5GXKXQC
TKFSYQ2ZTEPN27IGKGEYSUS7FQ2AUIC7DJWFF2RJ53AW6QRPMXWQC
2ENZW7TVCS47BWCA4AIEVGKGMT4Y2TSM5IJ7O5K2VSWNXIN3SG4QC
DHI6IJCNSTHGED67T6H5X6Y636C7PIDGIJD32HBEKLT5WIMRS5MAC
BULPIBEGL7TMK6CVIE7IS7WGAHGOSUJBGJSFQK542MOWGHP2ADQQC
HYEAFRZ2UEKDYTAE2GDQLHEJBPQASP2NDLMXB7F6MTVK2BKOXKEAC
ULKLJBN6Q2EXYOXGIJLJ5NZPZD2MQSWR63Z2I3KDYJDAJQA5VNZAC
BOFNXP5GZDCUMQG3LQVTSSFEQP7REQ4RIRJLDLETFSAGFTVDVEKAC
2RXZ3PGOTTZ6M4R372JXIKPLBQKPVBMAXNPIEO2HZDN4EMYW4GNAC
5L7K4GBDEAFH44LMLNKVFMHLWDNXXBKRPEI347VE5ZLXVFSMD2FAC
GE56XURAWLO62DQKV4KJBJR4RGN2MVHQME2B44VVTCBYTBPZRP4AC
OIB2QPRCB4MAVZV5NCEKSAL45ITT6V4BYSET3Q2VCT3WBOIC4QVQC
OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC
DLQMM2656JHXX3ONOEM6UIOXKFJFT5QT7RHWK7YS2W77PVZWHRSAC
AVTNUQYRBW7IX2YQ3KDLVQ23RGW3BAKTAE7P73ASBYNKOHMQMH5AC
Z4XRNDTRTGSZHNB65WNHOVUBFW4QWQABLVSK4RM3QJHGK33DMRJAC
-- Return any intersection of the region from Selection1 to Cursor1 with the
-- region between {line=line_index, pos=apos} and {line=line_index, pos=bpos}.
-- Return any intersection of the region from Selection1 to Cursor1 (or
-- current mouse, if mouse is pressed; or recent mouse if mouse is pressed and
-- currently over a drawing) with the region between {line=line_index, pos=apos}
-- and {line=line_index, pos=bpos}.
end
end
-- inefficient for some reason, so don't do it on every frame
function Text.mouse_pos()
local time = love.timer.getTime()
if Recent_mouse.time and Recent_mouse.time > time-0.1 then
return Recent_mouse.line, Recent_mouse.pos
end
Recent_mouse.time = time
local line,pos = Text.to_pos(love.mouse.getX(), love.mouse.getY())
if line then
Recent_mouse.line = line
Recent_mouse.pos = pos