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EECG7ACIN6ZK72ED3DKYZKBNM5M5OMTD4M6HLNMAH376NYNAEAC
UJ27PGBNBE7ARCKWT7O7BX6RVU5DDEYLKYRQYFBUWHLDMYKZ2CZQC
PJNQY5CDYYWKFUFK3OFXU7UZCFTTMBSYDMEKIY7LUZIB5XFRTQQQC
7JAODGVLU6GEMEJTJL34QMYOCKWPFX22A4UH5SLSDGSIVIRETO7QC
4PPQU5WW2BHKO32CY24KGQXM6GHZQCIWQYQ2JATKJWYIE3HMMX5QC
ZU3HJ6NH26LFY2NWRCCRMXECNEPVR25OJNOFEK5XJ3KYFJUCKQXAC
XV52L22IDM4Y22GLHJOPWWCEXRGJVUJWXDHSFS2UQNX66CE55VJQC
DFO5SFDTU6GR5XQ4X5U6I2BENQNQP3M4EUUQ2E2DQEB3YQYS2WIAC
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
pane.top = Header_height + Margin_above
pane.left = App.screen.width/2 - 20*App.width(Em)
pane.right = App.screen.width/2 + 20*App.width(Em)
edit.draw(pane)
if Cursor_pane.col >= 1 then
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
if pane then
pane.top = Header_height + Margin_above
pane.left = App.screen.width/2 - 20*App.width(Em)
pane.right = App.screen.width/2 + 20*App.width(Em)
edit.draw(pane)
end
end
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
if pane and pane.editable then
edit.quit(pane)
if Cursor_pane.col >= 1 then
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
if pane and pane.editable then
edit.quit(pane)
end
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
edit.mouse_pressed(pane, x,y, mouse_button)
pane._height = nil
if Cursor_pane.col >= 1 then
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
if pane then
edit.mouse_pressed(pane, x,y, mouse_button)
pane._height = nil
end
end
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
if not pane.editable then
-- global hotkeys for normal mode
if t == 'X' then
command.wider_columns()
return
elseif t == 'x' then
command.narrower_columns()
return
end
-- send keys to the current pane
else
if pane.cursor_x >= 0 and pane.cursor_x < App.screen.width then
if pane.cursor_y >= Header_height and pane.cursor_y < App.screen.height then
edit.textinput(pane, t)
if Cursor_pane.col >= 1 then
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
if pane then
if not pane.editable then
-- global hotkeys for normal mode
if t == 'X' then
command.wider_columns()
return
elseif t == 'x' then
command.narrower_columns()
return
end
-- send keys to the current pane
else
if pane.cursor_x >= 0 and pane.cursor_x < App.screen.width then
if pane.cursor_y >= Header_height and pane.cursor_y < App.screen.height then
edit.textinput(pane, t)
end
end
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
if pane.editable then
edit.textinput(pane, t)
if Cursor_pane.col >= 1 then
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
if pane then
if pane.editable then
edit.textinput(pane, t)
end
end
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
if pane and pane.editable then
keychord_pressed_on_editable_pane(pane, chord, key)
else
keychord_pressed_in_normal_mode_with_immutable_pane(pane, chord, key)
if Cursor_pane.col >= 1 then
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
if pane and pane.editable then
keychord_pressed_on_editable_pane(pane, chord, key)
else
keychord_pressed_in_normal_mode_with_immutable_pane(pane, chord, key)
end
-- editable cursor pane will have already updated its screen_top, so don't clobber it here
plan_draw{ignore_editable_cursor_pane=true}
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
refresh_pane_height(pane)
plan_draw()
if Cursor_pane.col >= 1 then
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
if pane then
refresh_pane_height(pane)
plan_draw()
end
end