Drawings can't be drawn partially, which sometimes makes things jerky.
3OKKTUT4Q7W44JHILOFV5BVUA7ZOBIHBCEXGZ65CPXV4PRLI2W4QC ESETRNLB3MIJ2SID6HJMMP52FEVUBLGK2HLWD75KDQZAKQMKSF2QC 2RXZ3PGOTTZ6M4R372JXIKPLBQKPVBMAXNPIEO2HZDN4EMYW4GNAC BULPIBEGL7TMK6CVIE7IS7WGAHGOSUJBGJSFQK542MOWGHP2ADQQC 242L3OQXTU2TCAINRJXQEEDSXQXM7Y7USUPBK37ZNM3A7V5TUDSAC TRNWIQN6RPLDLYWULLKG5L255E7E3DPNGLCSLAF6IJWYQRCCLARQC PYGMASTVHDTGX3LDTL364UWXEHVSWQ7STAJLZZI5YY6EA6EEICOAC DXT4QTAH5G6J7ZB3SMOOXVECKWYUPZVE2ODMUFTPPNHLTOSZLQSAC local cursor2 = Text.to2(Cursor1)print('cursor pos '..tostring(Cursor1.pos)..' is on the #'..tostring(cursor2.screen_line)..' screen line down')local y = Screen_height - cursor2.screen_pos*math.floor(15*Zoom)
local top2 = Text.to2(Cursor1)--? print('cursor pos '..tostring(Cursor1.pos)..' is on the #'..tostring(top2.screen_line)..' screen line down')local y = Screen_height - math.floor(15*Zoom)
if Screen_top1.line == 1 then break endprint('y', y)local h = 0if Lines[Screen_top1.line-1].mode == 'drawing' thenh = 20 + Drawing.pixels(Lines[Screen_top1.line-1].h)elseif Lines[Screen_top1.line-1].screen_line_starting_pos == nil thenh = h + math.floor(15*Zoom) -- text height
--? print(y, 'top2:', top2.line, top2.screen_line, top2.screen_pos)if top2.line == 1 and top2.screen_line == 1 then break endif top2.screen_line > 1 or Lines[top2.line-1].mode == 'text' thenlocal h = math.floor(15*Zoom)if y - h < 15 then -- top margin = 15breakendy = y - h
local n = #Lines[Screen_top1.line-1].screen_line_starting_posh = h + n*math.floor(15*Zoom) -- text heightendprint('height:', h)if y - h < 0 thenbreakendy = y - hif y < math.floor(15*Zoom) thenbreak
assert(top2.line > 1)assert(Lines[top2.line-1].mode == 'drawing')-- We currently can't draw partial drawings, so either skip it entirely-- or not at all.local h = 20 + Drawing.pixels(Lines[Screen_top1.line-1].h)if y - h < 15 thenbreakend--? print('skipping drawing of height', h)y = y - h
endfunction Text.previous_screen_line(pos2)if pos2.screen_line > 1 thenreturn {line=pos2.line, screen_line=pos2.screen_line-1, screen_pos=1}elseif pos2.line == 1 thenreturn pos2elseif Lines[pos2.line-1].mode == 'drawing' thenreturn {line=pos2.line-1, screen_line=1, screen_pos=1}elselocal l = Lines[pos2.line-1]if l.screen_line_starting_pos == nil thenreturn {line=pos2.line-1, screen_line=1, screen_pos=1}elsereturn {line=pos2.line-1, screen_line=#Lines[pos2.line-1].screen_line_starting_pos, screen_pos=1}endend