I'm trying to move the pane as infrequently as possible. However, when I do I make sure to put the entire cursor pane inside the viewport.
HQCEHEHJXKH7ZU4OGLHT5QCY75YKPBH6WVSLXJKSQI4V7PKUBVEQC
IUBUKOBFGTLXNHRNYGVN35F5OQISTGQDB27WMS2LXBVVBXCXGUDQC
7AKT7IKOP6VQW3CABAVXCEZTHYNAETVXGFIQWB2L6I7LM7T57HAAC
OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC
SKMUH5RWOBUHRAQ3TUEIH5EEHN3YOC35GJOJY7GPY7VY6QXLSODAC
VHWC2IGQD72ZZUIONIAEP45KPMPX2N6DXN6NU2QGBIWDUHP7INAAC
TZ3ZNGRMZ3DG33VVEZI74W5W5T73JYMEIYQ3SO6Y4A6FN3OUZIKQC
4P4AGIIG55VT6Y3JZVZPB756H4N2C6NTVMWCOOGCOSY63K4ILBFAC
GQBUV2XOMEPMTXMPCBQWGGIUXGQDX77VTGPFIG6YT7G64ASOYHXQC
GWS6ZSRN42IR33F5MKX7XQM4EREIZKPUM73EBZUFEZACDIMNUIGQC
local col_sx = left_edge_sx(Cursor_pane.col)
if col_sx > Display_settings.x + App.screen.width - Display_settings.column_width then
Display_settings.x = math.max(0, col_sx + Display_settings.column_width + Margin_right + Padding_horizontal - App.screen.width)
Display_settings.y = 0
update_pane_bounds()
end