save to disk when leaving thread view

This commit is contained in:
Kartik K. Agaram 2023-06-22 18:23:04 -07:00
parent c06afaa207
commit 5cf3d9bc2c
3 changed files with 15 additions and 0 deletions

View File

@ -1,6 +1,7 @@
on.keychord_press = function(chord, key)
print('key', chord)
if Global_state.thread and chord == 'C-o' then
quit_all_editors(Global_state.thread)
Global_state.thread = nil
reset_viewport()
A()

9
0137-quit_all_editors Normal file
View File

@ -0,0 +1,9 @@
quit_all_editors = function(node)
if node.type == 'text' and not node.button then
edit.quit(node.editor)
elseif node.type == 'rows' or node.type == 'cols' then
for _,child in ipairs(node.data) do
quit_all_editors(child, dt)
end
end
end

5
0138-on.quit Normal file
View File

@ -0,0 +1,5 @@
on.quit = function()
if Global_state.thread then
quit_all_editors(Global_state.thread)
end
end