Another ugly special case, but I think this is still cleaner than pre-dabb7a6c4.
NQBUJ4VZQJZP2X2J2UG27XVY5LCGNVAOE5RFZJA5BASITUQSVIUQC
OKBAAAUJRSAG7VYNKTBHEOOAMNFKREFMW2PHGNEAA2ZKSFONRR4AC
VPCPK52KMU4MZUXP4SUSJJDEHDR4C3KJ45HLMUQUK32FMY6OCQ4QC
KKMFQDR43ZWVCDRHQLWWX3FCWCFA3ZSXYOBRJNPHUQZR2XPKWULAC
AHOO2ILEJWTPCYHJH26WAF7A4YYVMHFX4UWHSAAAMHI73TSQZ6CAC
NP5DODWMHP22MO6Z3B6NYDR7C3DLV2BD4NKT2RFFFOSIDPC3ZPWQC
JMUE7GSN6QDQZ6NDRB55MRJMKJN6LBD6MVQPKROYPDOIXM7I3XNQC
3U6YMMN2GMRL27TLPE7V3KUGM6MI2L3SAQSNU6HMNRINVXVRL3QAC
log(2, 'keychord 2: '..chord..' '..tostring(pane.screen_top1.line)..' '..tostring(pane.screen_top1.pos))
if chord == 'backspace' or chord == 'up' or chord == 'left' then
if chord == 'pagedown' then
pan_surface_to_screen_top_of_cursor_pane()
elseif chord == 'backspace' or chord == 'up' or chord == 'left' then
function pan_surface_to_screen_top_of_cursor_pane()
if Cursor_pane.col < 1 then
return
end
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
if pane == nil then
return
end
Display_settings.y = up_edge_sy(Cursor_pane.col, Cursor_pane.row) + y_of_schema1(pane, pane.screen_top1)
end
log(2, 'bring_in_view: viewport before: '..tostring(Display_settings.x)..','..Display_settings.y)
log(2, 'bring_in_view: pane before: '..tostring(pane.screen_top1.line)..' '..tostring(pane.screen_top1.pos)..' '..tostring(pane.cursor1.line)..' '..tostring(pane.cursor1.pos))
log(2, 'bring_in_view: pane starts at '..tostring(up_edge_sy(Cursor_pane.col, Cursor_pane.row)))
log(2, 'bring_in_view: cursor line contains ^'..pane.lines[pane.cursor1.line].data..'$')
log(2, 'bring_in_view: cursor is at '..tostring(y_of_schema1(pane, pane.cursor1))..' from top of pane')