4A6GJRVUV7PVB62QCNDN7RN6NBHEDN6XPUFJXX22G2OCGNKLCTCAC
5E6DJTFMGUDYGZ3WT5BGSR7KO5WWZ3LV47HNMTHWVIJLBACTRWVQC
Y3XOLUYVSWJYRIVWLT3SML7GTMJHMWCTHZJF3ZZ5Q5DY4E6VG72AC
QRHK34F2WMGVH44UZGT4ZMLMF5W6GL23YZ723UAD6ZEADYOMTEBAC
LW6UME22NIRDLYNQDP47SLYT2ZEBD4HMHQOJNXJRRXQYVMNF4IGAC
VAMA5WWY2UDCK4UPFY4YV2BM6ETRCQTY6IP3AVKS4L3VHLBYFS2AC
OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC
IGYF6FQOON2BT5JFBELGFN2AGELRISIGNOXKWKD2DY5P5BXEDTOAC
UGEB2N5EVBSHMMJNDKYEHFYH2HHXEHJK3UWSXZB4BCVQR2N65OAAC
F7MP5BERVKCYMWFWQ7EBOJFYY3FYWFVLYENXTWKPREGDLFRESPBAC
L2R5WULWN44SCNUPP7R7I2AQCWQR6D3E2YZA35RBXZAR2LGC6LQQC
S4U35JJQWC3CBNKHAEZ2DYEGUT5L3UYVAO6PJ5R7HSTD53KWVAXQC
-- return if cursor is not visible on screen
if pane.cursor_x < 0 or pane.cursor_x >= App.screen.width then
return
end
if pane.cursor_y < Header_height or pane.cursor_y >= App.screen.height then
return
end
if chord == 'C-e' then
command.exit_editing()
else
--? print(('%s pressed in editor pane'):format(chord))
local old_top = {line=pane.screen_top1.line, pos=pane.screen_top1.pos}
edit.keychord_pressed(pane, chord, key)
--? print('screen top after:', pane.screen_top1.line, pane.screen_top1.pos)
Editable_cursor_pane_updated_screen_top = not eq(old_top, pane.screen_top1)
if Editable_cursor_pane_updated_screen_top then
--? print('updating viewport based on screen top')
Display_settings.y = up_edge_sy(Cursor_pane.col, Cursor_pane.row) + y_of_schema1(pane, pane.screen_top1)
--? print(('display settings.y is now %d'):format(Display_settings.y))
Surface.cursor_on_screen_check = true -- cursor was on screen before keystroke, so it should remain on screen after
end
update_metadata(pane)
end
keychord_pressed_on_editable_pane(pane, chord, key)
-- return if no part of cursor pane is visible
local left_sx = left_edge_sx(Cursor_pane.col)
if not overlap(left_sx, left_sx+Display_settings.column_width, Display_settings.x, Display_settings.x+App.screen.width) then
return
end
local up_sy = up_edge_sy(Cursor_pane.col, Cursor_pane.row)
if not overlap(up_sy, up_sy+pane.height, Display_settings.y, Display_settings.y+App.screen.height-Header_height) then
return
end
if chord == 'C-e' then
command.edit_note_at_cursor()
else
keychord_pressed_on_immutable_pane(pane, chord, key)
end
keychord_pressed_in_normal_mode_with_immutable_pane(pane, chord, key)
end
function keychord_pressed_on_editable_pane(pane, chord, key)
-- ignore if cursor is not visible on screen
if pane.cursor_x < 0 or pane.cursor_x >= App.screen.width then
return
end
if pane.cursor_y < Header_height or pane.cursor_y >= App.screen.height then
return
end
if chord == 'C-e' then
command.exit_editing()
else
--? print(('%s pressed in editor pane'):format(chord))
local old_top = {line=pane.screen_top1.line, pos=pane.screen_top1.pos}
edit.keychord_pressed(pane, chord, key)
--? print('screen top after:', pane.screen_top1.line, pane.screen_top1.pos)
Editable_cursor_pane_updated_screen_top = not eq(old_top, pane.screen_top1)
if Editable_cursor_pane_updated_screen_top then
--? print('updating viewport based on screen top')
Display_settings.y = up_edge_sy(Cursor_pane.col, Cursor_pane.row) + y_of_schema1(pane, pane.screen_top1)
--? print(('display settings.y is now %d'):format(Display_settings.y))
Surface.cursor_on_screen_check = true -- cursor was on screen before keystroke, so it should remain on screen after
end
update_metadata(pane)
end
end
function keychord_pressed_in_normal_mode_with_immutable_pane(pane, chord, key)
-- return if no part of cursor pane is visible
local left_sx = left_edge_sx(Cursor_pane.col)
if not overlap(left_sx, left_sx+Display_settings.column_width, Display_settings.x, Display_settings.x+App.screen.width) then
return
end
local up_sy = up_edge_sy(Cursor_pane.col, Cursor_pane.row)
if not overlap(up_sy, up_sy+pane.height, Display_settings.y, Display_settings.y+App.screen.height-Header_height) then
return
end
if chord == 'C-e' then
command.edit_note_at_cursor()
else
keychord_pressed_on_immutable_pane(pane, chord, key)
end