about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--commands.lua1
-rw-r--r--source.lua12
2 files changed, 13 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 4047f38..5e917fb 100644
--- a/source.lua
+++ b/source.lua
@@ -299,12 +299,14 @@ function source.mouse_pressed(x,y, mouse_button)
 --?     print('click on edit side')
     if Focus ~= 'edit' then
       Focus = 'edit'
+      return
     end
     edit.mouse_pressed(Editor_state, x,y, mouse_button)
   elseif Show_log_browser_side and Log_browser_state.left <= x and x < Log_browser_state.right then
 --?     print('click on log_browser side')
     if Focus ~= 'log_browser' then
       Focus = 'log_browser'
+      return
     end
     log_browser.mouse_pressed(Log_browser_state, x,y, mouse_button)
     for _,line_cache in ipairs(Editor_state.line_cache) do line_cache.starty = nil end  -- just in case we scroll
@@ -361,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