We're not switching between A side and B side. Instead we always end up in A side after down arrow.
LWTLEHXFIC3DYOHZJ2DXIOAZZSU67WHO2F4XCR4R76E3MAK3UUMQC
MCSOCEE3NAGPXBLALPXA4EHXSWNC4AQ7M2O2KNZ3POOGZLTKGIBAC
SIH25NMC63DINWY3EBHDITTOPBABJODM7D5ZOG4CVC7GGDCX5S3AC
HTZ3WRQHWJHMRR354RCPYK3L7OB5KRDJPJEL3Q4Y7IVNCYN2TSJQC
XPXYD64Y76UT24GENTC6IWYNYWRCTZZE55YCBGWJT7YAYHIFZLXQC
BULPIBEGL7TMK6CVIE7IS7WGAHGOSUJBGJSFQK542MOWGHP2ADQQC
242L3OQXTU2TCAINRJXQEEDSXQXM7Y7USUPBK37ZNM3A7V5TUDSAC
3OKKTUT4Q7W44JHILOFV5BVUA7ZOBIHBCEXGZ65CPXV4PRLI2W4QC
QCPXQ2E3USF3Z6R6WJ2JKHTRMPKA6QWXFKKRMLXA3MXABJEL543AC
K3M447T3CSGWDNTPKVYK47JPDCS4S4WLTKEKWPNMIDN6TCAIQULAC
EAEGCJV5JOW46KCZKKPBFKZ4Z3SDB3X4R7TLNXFWCIQN5UCNSXFQC
HOSPP2ANSW654DYRTC6CQUQA2GUKV6T2FI7QBKXD2DZS3R32IMGAC
LF7BWEG4DKQI7NMXMZC4LC2BE5PB42HK5PD6OYBNIDMAZBJASOKQC
2L5MEZV344TOZLVY3432RHJFIRVXFD6O3GWLL5O4CV66BGAFTURQC
4KC7I3E2DIKLIP7LQRKB5WFA2Z5XZXAU46RFHNFQU5BVEJPDX6UQC
TGHAJBESCIEGWUE2D3FGLNOIAYT4D2IRGZKRXRMTUFW7QZETC7OAC
return {line=loc2.line-1, screen_line=#State.line_cache[loc2.line-1].screen_line_starting_pos, screen_pos=1}
if State.lines[loc2.line-1].dataB == nil or
(not State.expanded and not State.lines[loc2.line-1].expanded) then
print('c1', loc2.line-1, State.lines[loc2.line-1].data, '==', State.lines[loc2.line-1].dataB, State.line_cache[loc2.line-1].fragmentsB)
return {line=loc2.line-1, screen_line=#State.line_cache[loc2.line-1].screen_line_starting_pos, screen_pos=1}
end
-- try to switch to B
local prev_line_cache = State.line_cache[loc2.line-1]
local x = Margin_left + Text.screen_line_width(State, loc2.line-1, #prev_line_cache.screen_line_starting_pos) + AB_padding
Text.populate_screen_line_starting_posB(State, loc2.line-1, x)
local screen_line_starting_posB = State.line_cache[loc2.line-1].screen_line_starting_posB
print('c', loc2.line-1, State.lines[loc2.line-1].data, '==', State.lines[loc2.line-1].dataB, '==', #screen_line_starting_posB, 'starting from x', x)
if #screen_line_starting_posB > 1 then
print('c2')
return {line=loc2.line-1, screen_lineB=#State.line_cache[loc2.line-1].screen_line_starting_posB, screen_posB=1}
else
print('c3')
-- if there's only one screen line, assume it overlaps with A, so remain in A
return {line=loc2.line-1, screen_line=#State.line_cache[loc2.line-1].screen_line_starting_pos, screen_pos=1}
end