From 72791d9c35be82043a2f272a8cdeb11bd676a313 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 17 Sep 2022 20:37:40 -0700 Subject: [PATCH] some debug prints I'm starting to edit the sources from within the app in ernest. First question: why does the file navigation menu skip some files? These prints answer the question. --- commands.lua | 4 ++++ main.lua | 1 + run.lua | 1 + source.lua | 2 ++ 4 files changed, 8 insertions(+) diff --git a/commands.lua b/commands.lua index be9c9bf..29e4a3e 100644 --- a/commands.lua +++ b/commands.lua @@ -55,13 +55,16 @@ function add_hotkey_to_menu(s) end function source.draw_file_navigator() + log_start('render file navigator') for i,file in ipairs(File_navigation.candidates) do if file == 'source' then App.color(Menu_border_color) love.graphics.line(Menu_cursor-10,2, Menu_cursor-10,Menu_status_bar_height-2) end + log(2, file) add_file_to_menu(file, i == File_navigation.index) end + log_end('render file navigator') end function add_file_to_menu(s, cursor_highlight) @@ -70,6 +73,7 @@ function add_file_to_menu(s, cursor_highlight) end local width = App.width(Text_cache[s]) if Menu_cursor + width > App.screen.width - 5 then + log(2, 'skipped') return end if cursor_highlight then diff --git a/main.lua b/main.lua index fd0fe45..570a7a1 100644 --- a/main.lua +++ b/main.lua @@ -33,6 +33,7 @@ load_file_from_source_or_save_directory('drawing_tests.lua') -- but some files we want to only load sometimes function App.load() + log_new('session') if love.filesystem.getInfo('config') then Settings = json.decode(love.filesystem.read('config')) Current_app = Settings.current_app diff --git a/run.lua b/run.lua index 2dd159e..3a17225 100644 --- a/run.lua +++ b/run.lua @@ -15,6 +15,7 @@ end -- called only for real run function run.initialize(arg) + log_new('run') love.keyboard.setTextInput(true) -- bring up keyboard on touch screen love.keyboard.setKeyRepeat(true) diff --git a/source.lua b/source.lua index c752604..70b0814 100644 --- a/source.lua +++ b/source.lua @@ -11,6 +11,7 @@ function source.initialize_globals() Show_file_navigator = false File_navigation = { candidates = { + 'main', 'run', 'run_tests', 'log', @@ -56,6 +57,7 @@ end -- called only for real run function source.initialize() + log_new('source') love.keyboard.setTextInput(true) -- bring up keyboard on touch screen love.keyboard.setKeyRepeat(true)