Merge branch 'master' into PR_commandview_options2
This commit is contained in:
+30
-2
@@ -140,9 +140,25 @@ function common.fuzzy_match_with_recents(haystack, recents, needle)
|
||||
end
|
||||
|
||||
|
||||
function common.path_suggest(text)
|
||||
function common.path_suggest(text, root)
|
||||
if root and root:sub(-1) ~= PATHSEP then
|
||||
root = root .. PATHSEP
|
||||
end
|
||||
local path, name = text:match("^(.-)([^/\\]*)$")
|
||||
local files = system.list_dir(path == "" and "." or path) or {}
|
||||
-- ignore root if path is absolute
|
||||
local is_absolute = common.is_absolute_path(text)
|
||||
if not is_absolute then
|
||||
if path == "" then
|
||||
path = root or "."
|
||||
else
|
||||
path = (root or "") .. path
|
||||
end
|
||||
end
|
||||
|
||||
local files = system.list_dir(path) or {}
|
||||
if path:sub(-1) ~= PATHSEP then
|
||||
path = path .. PATHSEP
|
||||
end
|
||||
local res = {}
|
||||
for _, file in ipairs(files) do
|
||||
file = path .. file
|
||||
@@ -151,6 +167,13 @@ function common.path_suggest(text)
|
||||
if info.type == "dir" then
|
||||
file = file .. PATHSEP
|
||||
end
|
||||
if root then
|
||||
-- remove root part from file path
|
||||
local s, e = file:find(root, nil, true)
|
||||
if s == 1 then
|
||||
file = file:sub(e + 1)
|
||||
end
|
||||
end
|
||||
if file:lower():find(text:lower(), nil, true) == 1 then
|
||||
table.insert(res, file)
|
||||
end
|
||||
@@ -385,6 +408,11 @@ function common.normalize_path(filename)
|
||||
end
|
||||
|
||||
|
||||
function common.is_absolute_path(path)
|
||||
return path:sub(1, 1) == PATHSEP or path:match("^(%a):\\")
|
||||
end
|
||||
|
||||
|
||||
function common.path_belongs_to(filename, path)
|
||||
return string.find(filename, path .. PATHSEP, 1, true) == 1
|
||||
end
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ require "core.strict"
|
||||
require "core.regex"
|
||||
local common = require "core.common"
|
||||
local config = require "core.config"
|
||||
local style = require "core.style"
|
||||
local style = require "colors.default"
|
||||
local command
|
||||
local keymap
|
||||
local dirwatch
|
||||
@@ -605,7 +605,7 @@ end
|
||||
-- This function should get only filenames normalized using
|
||||
-- common.normalize_path function.
|
||||
function core.project_absolute_path(filename)
|
||||
if filename:match('^%a:\\') or filename:find('/', 1, true) == 1 then
|
||||
if common.is_absolute_path(filename) then
|
||||
return common.normalize_path(filename)
|
||||
elseif not core.project_dir then
|
||||
local cwd = system.absolute_path(".")
|
||||
|
||||
+1
-42
@@ -28,44 +28,7 @@ style.icon_font = renderer.font.load(DATADIR .. "/fonts/icons.ttf", 16 * SCALE,
|
||||
style.icon_big_font = style.icon_font:copy(23 * SCALE)
|
||||
style.code_font = renderer.font.load(DATADIR .. "/fonts/JetBrainsMono-Regular.ttf", 15 * SCALE)
|
||||
|
||||
style.background = { common.color "#2e2e32" } -- Docview
|
||||
style.background2 = { common.color "#252529" } -- Treeview
|
||||
style.background3 = { common.color "#252529" } -- Command view
|
||||
style.text = { common.color "#97979c" }
|
||||
style.caret = { common.color "#93DDFA" }
|
||||
style.accent = { common.color "#e1e1e6" }
|
||||
-- style.dim - text color for nonactive tabs, tabs divider, prefix in log and
|
||||
-- search result, hotkeys for context menu and command view
|
||||
style.dim = { common.color "#525257" }
|
||||
style.divider = { common.color "#202024" } -- Line between nodes
|
||||
style.selection = { common.color "#48484f" }
|
||||
style.line_number = { common.color "#525259" }
|
||||
style.line_number2 = { common.color "#83838f" } -- With cursor
|
||||
style.line_highlight = { common.color "#343438" }
|
||||
style.scrollbar = { common.color "#414146" }
|
||||
style.scrollbar2 = { common.color "#4b4b52" } -- Hovered
|
||||
style.scrollbar_track = { common.color "#252529" }
|
||||
style.nagbar = { common.color "#FF0000" }
|
||||
style.nagbar_text = { common.color "#FFFFFF" }
|
||||
style.nagbar_dim = { common.color "rgba(0, 0, 0, 0.45)" }
|
||||
style.drag_overlay = { common.color "rgba(255,255,255,0.1)" }
|
||||
style.drag_overlay_tab = { common.color "#93DDFA" }
|
||||
style.good = { common.color "#72b886" }
|
||||
style.warn = { common.color "#FFA94D" }
|
||||
style.error = { common.color "#FF3333" }
|
||||
style.modified = { common.color "#1c7c9c" }
|
||||
|
||||
style.syntax = {}
|
||||
style.syntax["normal"] = { common.color "#e1e1e6" }
|
||||
style.syntax["symbol"] = { common.color "#e1e1e6" }
|
||||
style.syntax["comment"] = { common.color "#676b6f" }
|
||||
style.syntax["keyword"] = { common.color "#E58AC9" } -- local function end if case
|
||||
style.syntax["keyword2"] = { common.color "#F77483" } -- self int float
|
||||
style.syntax["number"] = { common.color "#FFA94D" }
|
||||
style.syntax["literal"] = { common.color "#FFA94D" } -- true false nil
|
||||
style.syntax["string"] = { common.color "#f7c95c" }
|
||||
style.syntax["operator"] = { common.color "#93DDFA" } -- = + - / < >
|
||||
style.syntax["function"] = { common.color "#93DDFA" }
|
||||
|
||||
-- This can be used to override fonts per syntax group.
|
||||
-- The syntax highlighter will take existing values from this table and
|
||||
@@ -74,10 +37,6 @@ style.syntax["function"] = { common.color "#93DDFA" }
|
||||
style.syntax_fonts = {}
|
||||
-- style.syntax_fonts["comment"] = renderer.font.load(path_to_font, size_of_font, rendering_options)
|
||||
|
||||
style.log = {
|
||||
INFO = { icon = "i", color = style.text },
|
||||
WARN = { icon = "!", color = style.warn },
|
||||
ERROR = { icon = "!", color = style.error }
|
||||
}
|
||||
style.log = {}
|
||||
|
||||
return style
|
||||
|
||||
Reference in New Issue
Block a user