Removed underscore from start of globals, added VERSION
eg. `_SCALE` => `SCALE` prevents conflict with lua's own _NAME globals
This commit is contained in:
@@ -62,7 +62,7 @@ command.add(nil, {
|
||||
|
||||
["core:open-project-file"] = function()
|
||||
core.command_view:enter("Open Project File", function(text, item)
|
||||
text = core.project_dir .. _PATHSEP .. (item and item.text or text)
|
||||
text = core.project_dir .. PATHSEP .. (item and item.text or text)
|
||||
core.root_view:open_doc(core.open_doc(text))
|
||||
end, function(text)
|
||||
local files = {}
|
||||
|
||||
@@ -91,7 +91,7 @@ function common.path_suggest(text)
|
||||
local info = system.get_file_info(file)
|
||||
if info then
|
||||
if info.type == "dir" then
|
||||
file = file .. _PATHSEP
|
||||
file = file .. PATHSEP
|
||||
end
|
||||
if file:lower():find(text:lower(), nil, true) == 1 then
|
||||
table.insert(res, file)
|
||||
|
||||
@@ -8,7 +8,7 @@ config.mouse_wheel_scroll = 50
|
||||
config.file_size_limit = 10
|
||||
config.symbol_pattern = "[%a_][%w_]*"
|
||||
config.non_word_chars = " \t\n/\\()\"':,.;<>~!@#$%^&*|+=[]{}`?-"
|
||||
config.treeview_size = 200 * _SCALE
|
||||
config.treeview_size = 200 * SCALE
|
||||
config.undo_merge_timeout = 0.3
|
||||
config.max_undos = 10000
|
||||
config.highlight_current_line = true
|
||||
|
||||
+7
-7
@@ -32,7 +32,7 @@ local function project_scan_thread()
|
||||
|
||||
for _, file in ipairs(all) do
|
||||
if not file:find("^%.") then
|
||||
local file = path .. _PATHSEP .. file
|
||||
local file = path .. PATHSEP .. file
|
||||
local info = system.get_file_info(file)
|
||||
if info and info.size < size_limit then
|
||||
table.insert(info.type == "dir" and dirs or files, file)
|
||||
@@ -86,9 +86,9 @@ function core.init()
|
||||
core.project_files = {}
|
||||
core.project_dir = "."
|
||||
|
||||
local info = _ARGS[2] and system.get_file_info(_ARGS[2])
|
||||
local info = ARGS[2] and system.get_file_info(ARGS[2])
|
||||
if info and info.type == "dir" then
|
||||
core.project_dir = _ARGS[2]:gsub("[\\/]$", "")
|
||||
core.project_dir = ARGS[2]:gsub("[\\/]$", "")
|
||||
end
|
||||
|
||||
core.root_view = RootView()
|
||||
@@ -104,8 +104,8 @@ function core.init()
|
||||
local got_plugin_error = not core.load_plugins()
|
||||
local got_user_error = not core.try(require, "user")
|
||||
|
||||
for i = 2, #_ARGS do
|
||||
local filename = _ARGS[i]
|
||||
for i = 2, #ARGS do
|
||||
local filename = ARGS[i]
|
||||
local info = system.get_file_info(filename)
|
||||
if info and info.type == "file" then
|
||||
core.root_view:open_doc(core.open_doc(filename))
|
||||
@@ -146,7 +146,7 @@ end
|
||||
|
||||
function core.load_plugins()
|
||||
local no_errors = true
|
||||
local files = system.list_dir(_EXEDIR .. "/data/plugins")
|
||||
local files = system.list_dir(EXEDIR .. "/data/plugins")
|
||||
for _, filename in ipairs(files) do
|
||||
local modname = "plugins." .. filename:gsub(".lua$", "")
|
||||
local ok = core.try(require, modname)
|
||||
@@ -405,7 +405,7 @@ end
|
||||
|
||||
function core.on_error(err)
|
||||
-- write error to file
|
||||
local fp = io.open(_EXEDIR .. "/error.txt", "wb")
|
||||
local fp = io.open(EXEDIR .. "/error.txt", "wb")
|
||||
fp:write("Error: " .. tostring(err) .. "\n")
|
||||
fp:write(debug.traceback(nil, 4))
|
||||
fp:close()
|
||||
|
||||
+9
-9
@@ -1,16 +1,16 @@
|
||||
local common = require "core.common"
|
||||
local style = {}
|
||||
|
||||
style.padding = { x = common.round(14 * _SCALE), y = common.round(7 * _SCALE) }
|
||||
style.divider_size = common.round(1 * _SCALE)
|
||||
style.scrollbar_size = common.round(4 * _SCALE)
|
||||
style.caret_width = common.round(2 * _SCALE)
|
||||
style.tab_width = common.round(170 * _SCALE)
|
||||
style.padding = { x = common.round(14 * SCALE), y = common.round(7 * SCALE) }
|
||||
style.divider_size = common.round(1 * SCALE)
|
||||
style.scrollbar_size = common.round(4 * SCALE)
|
||||
style.caret_width = common.round(2 * SCALE)
|
||||
style.tab_width = common.round(170 * SCALE)
|
||||
|
||||
style.font = renderer.font.load(_EXEDIR .. "/data/fonts/font.ttf", 14 * _SCALE)
|
||||
style.big_font = renderer.font.load(_EXEDIR .. "/data/fonts/font.ttf", 34 * _SCALE)
|
||||
style.icon_font = renderer.font.load(_EXEDIR .. "/data/fonts/icons.ttf", 14 * _SCALE)
|
||||
style.code_font = renderer.font.load(_EXEDIR .. "/data/fonts/monospace.ttf", 13.5 * _SCALE)
|
||||
style.font = renderer.font.load(EXEDIR .. "/data/fonts/font.ttf", 14 * SCALE)
|
||||
style.big_font = renderer.font.load(EXEDIR .. "/data/fonts/font.ttf", 34 * SCALE)
|
||||
style.icon_font = renderer.font.load(EXEDIR .. "/data/fonts/icons.ttf", 14 * SCALE)
|
||||
style.code_font = renderer.font.load(EXEDIR .. "/data/fonts/monospace.ttf", 13.5 * SCALE)
|
||||
|
||||
style.background = { common.color "#1F1F2B" }
|
||||
style.background2 = { common.color "#181821" }
|
||||
|
||||
Reference in New Issue
Block a user