Merge branch 'master-2.0.3'
This commit is contained in:
commit
64bc2771c3
|
@ -9,7 +9,8 @@ local fullscreen = false
|
||||||
|
|
||||||
local function suggest_directory(text)
|
local function suggest_directory(text)
|
||||||
text = common.home_expand(text)
|
text = common.home_expand(text)
|
||||||
return common.home_encode_list(text == "" and core.recent_projects or common.dir_path_suggest(text))
|
return common.home_encode_list((text == "" or text == common.home_expand(common.dirname(core.project_dir)))
|
||||||
|
and core.recent_projects or common.dir_path_suggest(text))
|
||||||
end
|
end
|
||||||
|
|
||||||
command.add(nil, {
|
command.add(nil, {
|
||||||
|
@ -149,7 +150,7 @@ command.add(nil, {
|
||||||
["core:change-project-folder"] = function()
|
["core:change-project-folder"] = function()
|
||||||
local dirname = common.dirname(core.project_dir)
|
local dirname = common.dirname(core.project_dir)
|
||||||
if dirname then
|
if dirname then
|
||||||
core.command_view:set_text(common.home_encode(dirname) .. PATHSEP)
|
core.command_view:set_text(common.home_encode(dirname))
|
||||||
end
|
end
|
||||||
core.command_view:enter("Change Project Folder", function(text, item)
|
core.command_view:enter("Change Project Folder", function(text, item)
|
||||||
text = system.absolute_path(common.home_expand(item and item.text or text))
|
text = system.absolute_path(common.home_expand(item and item.text or text))
|
||||||
|
@ -166,7 +167,7 @@ command.add(nil, {
|
||||||
["core:open-project-folder"] = function()
|
["core:open-project-folder"] = function()
|
||||||
local dirname = common.dirname(core.project_dir)
|
local dirname = common.dirname(core.project_dir)
|
||||||
if dirname then
|
if dirname then
|
||||||
core.command_view:set_text(common.home_encode(dirname) .. PATHSEP)
|
core.command_view:set_text(common.home_encode(dirname))
|
||||||
end
|
end
|
||||||
core.command_view:enter("Open Project", function(text, item)
|
core.command_view:enter("Open Project", function(text, item)
|
||||||
text = common.home_expand(item and item.text or text)
|
text = common.home_expand(item and item.text or text)
|
||||||
|
|
|
@ -52,7 +52,7 @@ end
|
||||||
function Highlighter:insert_notify(line, n)
|
function Highlighter:insert_notify(line, n)
|
||||||
self:invalidate(line)
|
self:invalidate(line)
|
||||||
for i = 1, n do
|
for i = 1, n do
|
||||||
table.insert(self.lines, line, nil)
|
table.insert(self.lines, line, false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ end
|
||||||
|
|
||||||
function search.find(doc, line, col, text, opt)
|
function search.find(doc, line, col, text, opt)
|
||||||
doc, line, col, text, opt = init_args(doc, line, col, text, opt)
|
doc, line, col, text, opt = init_args(doc, line, col, text, opt)
|
||||||
|
local plain = not opt.pattern
|
||||||
local pattern = text
|
local pattern = text
|
||||||
local search_func = string.find
|
local search_func = string.find
|
||||||
if opt.regex then
|
if opt.regex then
|
||||||
|
@ -60,9 +61,9 @@ function search.find(doc, line, col, text, opt)
|
||||||
end
|
end
|
||||||
local s, e
|
local s, e
|
||||||
if opt.reverse then
|
if opt.reverse then
|
||||||
s, e = rfind(search_func, line_text, pattern, col - 1)
|
s, e = rfind(search_func, line_text, pattern, col - 1, plain)
|
||||||
else
|
else
|
||||||
s, e = search_func(line_text, pattern, col)
|
s, e = search_func(line_text, pattern, col, plain)
|
||||||
end
|
end
|
||||||
if s then
|
if s then
|
||||||
return line, s, line, e + 1
|
return line, s, line, e + 1
|
||||||
|
|
|
@ -149,10 +149,17 @@ function Node:remove_view(root, view)
|
||||||
else
|
else
|
||||||
locked_size = locked_size_y
|
locked_size = locked_size_y
|
||||||
end
|
end
|
||||||
if self.is_primary_node or locked_size then
|
local next_primary
|
||||||
|
if self.is_primary_node then
|
||||||
|
next_primary = core.root_view:select_next_primary_node()
|
||||||
|
end
|
||||||
|
if locked_size or (self.is_primary_node and not next_primary) then
|
||||||
self.views = {}
|
self.views = {}
|
||||||
self:add_view(EmptyView())
|
self:add_view(EmptyView())
|
||||||
else
|
else
|
||||||
|
if other == next_primary then
|
||||||
|
next_primary = parent
|
||||||
|
end
|
||||||
parent:consume(other)
|
parent:consume(other)
|
||||||
local p = parent
|
local p = parent
|
||||||
while p.type ~= "leaf" do
|
while p.type ~= "leaf" do
|
||||||
|
@ -160,7 +167,7 @@ function Node:remove_view(root, view)
|
||||||
end
|
end
|
||||||
p:set_active_view(p.active_view)
|
p:set_active_view(p.active_view)
|
||||||
if self.is_primary_node then
|
if self.is_primary_node then
|
||||||
p.is_primary_node = true
|
next_primary.is_primary_node = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -823,6 +830,24 @@ function RootView:get_primary_node()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function select_next_primary_node(node)
|
||||||
|
if node.is_primary_node then return end
|
||||||
|
if node.type ~= "leaf" then
|
||||||
|
return select_next_primary_node(node.a) or select_next_primary_node(node.b)
|
||||||
|
else
|
||||||
|
local lx, ly = node:get_locked_size()
|
||||||
|
if not lx and not ly then
|
||||||
|
return node
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function RootView:select_next_primary_node()
|
||||||
|
return select_next_primary_node(self.root_node)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function RootView:open_doc(doc)
|
function RootView:open_doc(doc)
|
||||||
local node = self:get_active_node_default()
|
local node = self:get_active_node_default()
|
||||||
for i, view in ipairs(node.views) do
|
for i, view in ipairs(node.views) do
|
||||||
|
|
|
@ -22,7 +22,7 @@ end
|
||||||
|
|
||||||
function syntax.get(filename, header)
|
function syntax.get(filename, header)
|
||||||
return find(filename, "files")
|
return find(filename, "files")
|
||||||
or find(header, "headers")
|
or (header and find(header, "headers"))
|
||||||
or plain_text_syntax
|
or plain_text_syntax
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -225,6 +225,9 @@ function TreeView:on_mouse_pressed(button, x, y, clicks)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
core.try(function()
|
core.try(function()
|
||||||
|
if core.last_active_view and core.active_view == self then
|
||||||
|
core.set_active_view(core.last_active_view)
|
||||||
|
end
|
||||||
local doc_filename = core.normalize_to_project_dir(hovered_item.abs_filename)
|
local doc_filename = core.normalize_to_project_dir(hovered_item.abs_filename)
|
||||||
core.root_view:open_doc(core.open_doc(doc_filename))
|
core.root_view:open_doc(core.open_doc(doc_filename))
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -186,7 +186,7 @@ main() {
|
||||||
|
|
||||||
rm -rf "${dest_dir}"
|
rm -rf "${dest_dir}"
|
||||||
|
|
||||||
DESTDIR="$(pwd)/${dest_dir}" meson install -C "${build_dir}"
|
DESTDIR="$(pwd)/${dest_dir}" meson install --skip-subprojects -C "${build_dir}"
|
||||||
|
|
||||||
local data_dir="$(pwd)/${dest_dir}/data"
|
local data_dir="$(pwd)/${dest_dir}/data"
|
||||||
local exe_file="$(pwd)/${dest_dir}/lite-xl"
|
local exe_file="$(pwd)/${dest_dir}/lite-xl"
|
||||||
|
|
Loading…
Reference in New Issue