diff --git a/res/layouts/code_editor.xml b/res/layouts/code_editor.xml index 906ff070..4336ee4f 100644 --- a/res/layouts/code_editor.xml +++ b/res/layouts/code_editor.xml @@ -1,14 +1,14 @@ - - + diff --git a/res/layouts/code_editor.xml.lua b/res/layouts/code_editor.xml.lua index e936aa71..6cb9ce68 100644 --- a/res/layouts/code_editor.xml.lua +++ b/res/layouts/code_editor.xml.lua @@ -1,5 +1,5 @@ local writeables = {} -local registry = require "core:internal/scripts_registry" +local registry local filenames local current_file = { @@ -163,7 +163,6 @@ end events.on("core:open_traceback", function(traceback_b64) local traceback = bjson.frombytes(base64.decode(traceback_b64)) - modes:set('debug') clear_traceback() @@ -257,14 +256,16 @@ function build_files_list(filenames, selected) end function on_open(mode) + registry = require "core:internal/scripts_registry" + local files_list = document.filesList - filenames = registry.filenames - table.sort(filenames) - build_files_list(filenames) - document.editorContainer:setInterval(200, refresh_file_title) clear_traceback() clear_output() + + filenames = registry.filenames + table.sort(filenames) + build_files_list(filenames) end diff --git a/res/layouts/console.xml.lua b/res/layouts/console.xml.lua index 10cad2ba..3617c08a 100644 --- a/res/layouts/console.xml.lua +++ b/res/layouts/console.xml.lua @@ -3,6 +3,12 @@ console_mode = "console" history = session.get_entry("commands_history") history_pointer = #history +events.on("core:open_traceback", function() + if modes then + modes:set('debug') + end +end) + function setup_variables() local pid = hud.get_player() local x,y,z = player.get_pos(pid) diff --git a/res/modules/internal/scripts_registry.lua b/res/modules/internal/scripts_registry.lua index de685224..8933c971 100644 --- a/res/modules/internal/scripts_registry.lua +++ b/res/modules/internal/scripts_registry.lua @@ -1,4 +1,7 @@ -local export = {} +local export = { + filenames = {}, + classification = {} +} local function collect_components(dirname, dest) if file.isdir(dirname) then