Now all we're doing is sticking to 10 columns. Let's see how this goes.
If this goes well then I'll take stock of all the different things I tried and decide which version is cleanest. For example, I'd like to drop either Editable_cursor_pane_updated_screen_top or options.ignore_editable_cursor_pane.
UAX3KJOIN3XBSLKP4IAWAWSCI3DLDKF22A6HRMGA4FHY3AS2QRVAC
ZBC6KQCAR727UGTWBHRXVDMGAAZIYIY4IX6JRKLDSXSPQ2Z2HOCAC
XNFTJHC4QSHNSIWNN7K6QZEZ37GTQYKHS4EPNSVPQCUSWREROGIQC
BULPIBEGL7TMK6CVIE7IS7WGAHGOSUJBGJSFQK542MOWGHP2ADQQC
MTJEVRJR5GLWUSK7HMIM4UXM6GS6O6YCRWJT3DUSU2RYMHCQNOEQC
SPSW74Y5OJ54Y7VQ3SJFCJR5CYDKTR4A3TOEVZODDZLUSDDU2GZAC
IM3RBHY2QI5UHLPHT4QB3YECS7CRBEFE765DDKXOW267AOQZL5QQC
Z5HLXU4PJWWJJDBCK52NBD6PIRIA3TAN2BKZB5HBYFGIDBX4F5HAC
JMUE7GSN6QDQZ6NDRB55MRJMKJN6LBD6MVQPKROYPDOIXM7I3XNQC
KKMFQDR43ZWVCDRHQLWWX3FCWCFA3ZSXYOBRJNPHUQZR2XPKWULAC
VPCPK52KMU4MZUXP4SUSJJDEHDR4C3KJ45HLMUQUK32FMY6OCQ4QC
GO534NHJW3FC4FNJXTA5QZYZJ5A7UHVTGPNB7G73GA2YJRX4D54AC
3IBO5P7DVWMJM42VZL5HIFAJH55FK77K2IKPGMNI55GRXDXT4WUQC
2L5MEZV344TOZLVY3432RHJFIRVXFD6O3GWLL5O4CV66BGAFTURQC
PTDO2SOTXEI6FROZ2AVRFXSKKNKCRMPPTQSI5LWD45UVGDJPMSGQC
IFTYOERMW7P3I24WISZN35X3GWJ5MSMRYDRBK3L52GCZTPP3CWZQC
if body_sy < Display_settings.y then
pane.screen_top1, y_offset = schema1_of_y(pane, Display_settings.y - body_sy)
else
pane.screen_top1 = {line=1, pos=1}
end
if body_sy < Display_settings.y then
pane.top = Margin_above
else
pane.top = body_sy - Display_settings.y + Margin_above
end
pane.top = Header_height + pane.top - y_offset
--? print('bounds: =>', pane.top)
pane.left = sx - Display_settings.x
pane.right = pane.left + Display_settings.column_width
pane.width = pane.right - pane.left
else
-- clear bounds to catch issues early
pane.top = nil
--? print('bounds: =>', pane.top)
end
sy = sy + Margin_above + height(pane) + Margin_below + Padding_vertical
end
else
-- clear bounds to catch issues early
for _, pane in ipairs(column) do
pane.top = nil
end
end
sx = sx + Margin_right + Display_settings.column_width + Padding_horizontal + Margin_left
end
end
-- keep the structure of this function sync'd with refresh_pane_height
function plan_draw_maybe_updating_screen_top_in_cursor_pane(update_screen_top_in_cursor_pane)
--? print('update pane bounds')
--? print(#Surface, 'columns;', num_panes(), 'panes')
Panes_to_draw = {}
local sx = Padding_horizontal + Margin_left
for column_index, column in ipairs(Surface) do
if should_show_column(sx) then
local sy = Padding_vertical
for pane_index, pane in ipairs(column) do
if sy > Display_settings.y + App.screen.height - Header_height then
break
end
--? print('bounds:', column_index, pane_index, sx,sy)
if should_show_pane(pane, sy) then
table.insert(Panes_to_draw, pane)
-- stash some short-lived variables
pane.column_index = column_index
pane.pane_index = pane_index
local y_offset = 0
local body_sy = sy
if column[pane_index].title then
body_sy = body_sy + 5+Line_height+5
end
if should_update_screen_top(column_index, pane_index, update_screen_top_in_cursor_pane) then
if should_update_screen_top(column_index, pane_index, pane, options) then
return including_cursor_pane
-- update the cursor pane either if it's not editable, or
-- if it was explicitly requested
if not pane.editable then return true end
if options == nil then return true end
if not options.ignore_editable_cursor_pane then return true end
if not Editable_cursor_pane_updated_screen_top then return true end
return false
local modified = edit.keychord_pressed(pane, chord, key)
if modified then
local cursor_pane_updated_screen_top = maybe_update_screen_top_of_cursor_pane(pane, old_top)
pane._height = nil
plan_draw_maybe_updating_screen_top_in_cursor_pane(not cursor_pane_updated_screen_top)
end
edit.keychord_pressed(pane, chord, key)
maybe_update_screen_top_of_cursor_pane(pane, old_top)
pane._height = nil
plan_draw{ignore_editable_cursor_pane=true}