A (random) hotkey toggles going into or leaving edit mode. While editing, we autosave every few seconds just like in lines.love. When leaving edit mode we also make sure to flush to disk. And update any other panes containing the same file.
I'm noticing a problem now where word-wrap behaves differently on the first column vs other columns. But only after the first load. So before left/right have been initialized?
DUQDA3U7VNWZSKRVACS6G3FTEB5VXRR7FJQU5NYZ4EFSGL3XUU5QC
VHWC2IGQD72ZZUIONIAEP45KPMPX2N6DXN6NU2QGBIWDUHP7INAAC
HEL54WE5OI5MS7VXNODYHFIWX4L4DO5CINWRKVBUV3GZ52AVX5KQC
3QQZ7W4EJ7G4HQM5IYWXICMAHVRGERY4X6AOC6LOV5NSZ4OBICSAC
OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC
4BX4GJEWW7Z5LA4SJUXADYLAHOYFL4IBOYH4J4DJYRAVKKGGFHGQC
J3ER7DFO2TXYUMJAXZUFEHQNLFDNIXSYDTE7HEFGQ2RYB3A6RFPAC
X22MOJHFLXMZQJN4IP2HAXIIVD2ALPR4EO5V5YDYF6QPXS7ZNB6QC
Cache['foo'] = {lines=load_from_disk('foo'), left=0, right=Display_settings.column_width}
Cache['foo2'] = {lines=load_from_disk('foo2'), left=0, right=Display_settings.column_width}
Cache['foo'] = {lines=load_from_disk(Directory..'foo'), left=0, right=Display_settings.column_width}
Cache['foo2'] = {lines=load_from_disk(Directory..'foo2'), left=0, right=Display_settings.column_width}
--? function love.quit()
--? edit.quit(Editor_state)
--? -- save some important settings
function love.quit()
if Cursor_pane then
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
if pane.show_cursor then
edit.quit(pane)
end
end
--? -- TODO: save important settings
--? function App.textinput(t)
--? Cursor_time = 0 -- ensure cursor is visible immediately after it moves
--? return edit.textinput(Editor_state, t)
--? end
--?
--? function App.keychord_pressed(chord, key)
--? Cursor_time = 0 -- ensure cursor is visible immediately after it moves
--? return edit.keychord_pressed(Editor_state, chord, key)
--? end
--?
function App.textinput(t)
Cursor_time = 0 -- ensure cursor is visible immediately after it moves
if not Cursor_pane then return end
-- hotkeys operating on the cursor pane
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
if pane.show_cursor then
return edit.textinput(pane, t)
end
end
function App.keychord_pressed(chord, key)
Cursor_time = 0 -- ensure cursor is visible immediately after it moves
-- global hotkeys go here
if not Cursor_pane then return end
-- hotkeys operating on the cursor pane
local pane = Surface[Cursor_pane.col][Cursor_pane.row]
if chord == 'C-x' then
pane.show_cursor = not pane.show_cursor
if pane.show_cursor == false then
edit.quit(pane) -- save
refresh_panes(pane)
end
return
end
if pane.show_cursor then
return edit.keychord_pressed(pane, chord, key)
else
end
end
function refresh_panes(pane)
--? print('refreshing')
Cache[pane.id].lines = pane.lines
for x,col in ipairs(Surface) do
for y,p in ipairs(col) do
if p.id == pane.id then
--? print(x,y)
p.lines = pane.lines
Text.redraw_all(p)
end
end
end
end