about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-12-05 15:26:38 -0800
committerKartik K. Agaram <vc@akkartik.com>2022-12-05 15:26:38 -0800
commitf9bea7783b4779172543901c14a02c18c50ad4f4 (patch)
tree805d33f34a0508401e036fba41ecfe785744a947
parent0167c57cdf3bcdb1102d4d10d02c0eb078dc8736 (diff)
downloadtext.love-f9bea7783b4779172543901c14a02c18c50ad4f4.tar.gz
source editor: clear logs
-rw-r--r--commands.lua1
-rw-r--r--source.lua10
2 files changed, 11 insertions, 0 deletions
diff --git a/commands.lua b/commands.lua
index 67ddef9..dd096ac 100644
--- a/commands.lua
+++ b/commands.lua
@@ -23,6 +23,7 @@ function source.draw_menu_bar()
     else
       add_hotkey_to_menu('ctrl+l: show log browser')
     end
+    add_hotkey_to_menu('ctrl+k: clear logs')
     if Editor_state.expanded then
       add_hotkey_to_menu('alt+b: collapse debug prints')
     else
diff --git a/source.lua b/source.lua
index dfffd62..096512b 100644
--- a/source.lua
+++ b/source.lua
@@ -363,6 +363,16 @@ function source.keychord_pressed(chord, key)
     end
     return
   end
+  if chord == 'C-k' then
+    -- clear logs
+    love.filesystem.remove('log')
+    -- restart to reload state of logs on screen
+    source.quit()
+    load_file_from_source_or_save_directory('main.lua')
+    App.undo_initialize()
+    App.run_tests_and_initialize()
+    return
+  end
   if chord == 'C-g' then
     Show_file_navigator = true
     return