EAEGCJV5JOW46KCZKKPBFKZ4Z3SDB3X4R7TLNXFWCIQN5UCNSXFQC
VSBSWTE4IVQDRXLPQ7VTDIIEBEF7GMGRBHZ2IA73ZR6B2KZWI5JAC
TGHAJBESCIEGWUE2D3FGLNOIAYT4D2IRGZKRXRMTUFW7QZETC7OAC
MXA3RZYKUI4UF2ISY7JEF6VKX6NOPZMZH5SLLCZHRJKFIXXXDPSAC
BULPIBEGL7TMK6CVIE7IS7WGAHGOSUJBGJSFQK542MOWGHP2ADQQC
H2DPLWMVRFYTO2CQTG54FMT2LF3B6UKLXH32CUA22DNQJVP5XBNQC
QCPXQ2E3USF3Z6R6WJ2JKHTRMPKA6QWXFKKRMLXA3MXABJEL543AC
EGH7XDBKE3R74VXLNTCAP5LJTRBPFUEMPS647MJARDGCMUHJG2QQC
LF7BWEG4DKQI7NMXMZC4LC2BE5PB42HK5PD6OYBNIDMAZBJASOKQC
2RXZ3PGOTTZ6M4R372JXIKPLBQKPVBMAXNPIEO2HZDN4EMYW4GNAC
3OKKTUT4Q7W44JHILOFV5BVUA7ZOBIHBCEXGZ65CPXV4PRLI2W4QC
ODLKHO7BO2AODYO2OEQ6D4NSNBT5GR3CKLUXWMDLRYXL7DJOI7BAC
KZ5GAYRPWF2BA5VEIW3A4G2TULATBL7YEDGFJU42GBP5DET7BI3AC
ILOA5BYFTQKBSHLFMMZUVPQ2JXBFJD62ERQFBTDK2WSRXUN525VQC
AYE2VEGJ63AWWX76SFQZLOTBIZOQRWBG4AZMIOSVOI2WZVRQJXYAC
2CH77LZCSHAKRKLCCJGDGECVYFNCEV23NF3PFXHAQ2E33AJGSNVAC
function Text.to2(State, pos1)
if State.lines[pos1.line].mode == 'drawing' then
return {line=pos1.line, screen_line=1, screen_pos=1}
function Text.to2(State, loc1)
if State.lines[loc1.line].mode == 'drawing' then
return {line=loc1.line, screen_line=1, screen_pos=1}
local result = {line=pos1.line, screen_line=1}
Text.populate_screen_line_starting_pos(State, pos1.line)
for i=#State.line_cache[pos1.line].screen_line_starting_pos,1,-1 do
local spos = State.line_cache[pos1.line].screen_line_starting_pos[i]
if spos <= pos1.pos then
local result = {line=loc1.line, screen_line=1}
Text.populate_screen_line_starting_pos(State, loc1.line)
for i=#State.line_cache[loc1.line].screen_line_starting_pos,1,-1 do
local spos = State.line_cache[loc1.line].screen_line_starting_pos[i]
if spos <= loc1.pos then
function Text.to1(State, pos2)
local result = {line=pos2.line, pos=pos2.screen_pos}
if pos2.screen_line > 1 then
result.pos = State.line_cache[pos2.line].screen_line_starting_pos[pos2.screen_line] + pos2.screen_pos - 1
function Text.to1(State, loc2)
local result = {line=loc2.line, pos=loc2.screen_pos}
if loc2.screen_line > 1 then
result.pos = State.line_cache[loc2.line].screen_line_starting_pos[loc2.screen_line] + loc2.screen_pos - 1
function Text.previous_screen_line(State, pos2)
if pos2.screen_line > 1 then
return {line=pos2.line, screen_line=pos2.screen_line-1, screen_pos=1}
elseif pos2.line == 1 then
return pos2
elseif State.lines[pos2.line-1].mode == 'drawing' then
return {line=pos2.line-1, screen_line=1, screen_pos=1}
function Text.previous_screen_line(State, loc2)
if loc2.screen_line > 1 then
return {line=loc2.line, screen_line=loc2.screen_line-1, screen_pos=1}
elseif loc2.line == 1 then
return loc2
elseif State.lines[loc2.line-1].mode == 'drawing' then
return {line=loc2.line-1, screen_line=1, screen_pos=1}
local l = State.lines[pos2.line-1]
Text.populate_screen_line_starting_pos(State, pos2.line-1)
return {line=pos2.line-1, screen_line=#State.line_cache[pos2.line-1].screen_line_starting_pos, screen_pos=1}
local l = State.lines[loc2.line-1]
Text.populate_screen_line_starting_pos(State, loc2.line-1)
return {line=loc2.line-1, screen_line=#State.line_cache[loc2.line-1].screen_line_starting_pos, screen_pos=1}