Merge remote-tracking branch 'origin/master' into dev

This commit is contained in:
Francesco Abbate 2021-02-09 18:39:39 +01:00
commit a8c810d801
4 changed files with 21 additions and 14 deletions

View File

@ -37,8 +37,8 @@ local function normalize_path(s)
end
local function add_project_to_recents(dirname)
dirname = normalize_path(system.absolute_path(dirname))
local function add_project_to_recents(dir_path_abs)
local dirname = normalize_path(dir_path_abs)
if not dirname then return end
local recents = core.recent_projects
local n = #recents
@ -74,11 +74,11 @@ function core.set_project_dir(new_dir, change_project_fn)
end
function core.open_folder_project(dirname)
if core.set_project_dir(dirname, core.on_quit_project) then
function core.open_folder_project(dir_path_abs)
if core.set_project_dir(dir_path_abs, core.on_quit_project) then
core.root_view:close_all_docviews()
add_project_to_recents(dirname)
core.on_enter_project(dirname)
add_project_to_recents(dir_path_abs)
core.on_enter_project(dir_path_abs)
end
end
@ -381,7 +381,7 @@ function core.init()
local project_dir_abs = system.absolute_path(project_dir)
local set_project_ok = core.set_project_dir(project_dir_abs)
if set_project_ok then
add_project_to_recents(project_dir)
add_project_to_recents(project_dir_abs)
else
core.error("Cannot enter project directory %q", project_dir)
project_dir_abs = system.absolute_path(".")
@ -460,7 +460,7 @@ end
function core.temp_filename(ext)
temp_file_counter = temp_file_counter + 1
return EXEDIR .. PATHSEP .. temp_file_prefix
return USERDIR .. PATHSEP .. temp_file_prefix
.. string.format("%06x", temp_file_counter) .. (ext or "")
end

View File

@ -52,7 +52,8 @@ function ResultsView:begin_search(text, fn)
local i = 1
for dir_name, file in core.get_project_files() do
if file.type == "file" then
find_all_matches_in_file(self.results, dir_name .. PATHSEP .. file.filename, fn)
local path = (dir_name == core.project_dir and "" or (dir_name .. PATHSEP))
find_all_matches_in_file(self.results, path .. file.filename, fn)
end
self.last_file_idx = i
i = i + 1

View File

@ -35,7 +35,11 @@ function TreeView:get_cached(item, dirname)
dir_cache = {}
self.cache[dirname] = dir_cache
end
local t = dir_cache[item.filename]
-- to discriminate top directories from regular files or subdirectories
-- we add ':' at the end of the top directories' filename. it will be
-- used only to identify the entry into the cache.
local cache_name = item.filename .. (item.topdir and ":" or "")
local t = dir_cache[cache_name]
if not t then
t = {}
local basename = common.basename(item.filename)
@ -51,7 +55,7 @@ function TreeView:get_cached(item, dirname)
end
t.name = basename
t.type = item.type
dir_cache[item.filename] = t
dir_cache[cache_name] = t
end
return t
end

View File

@ -15,7 +15,7 @@ copy_directory_from_repo () {
lite_copy_third_party_modules () {
local build="$1"
curl --insecure -L "https://github.com/rxi/lite-colors/archive/master.zip" -o "$build/rxi-lite-colors.zip"
curl --retry 5 --retry-delay 3 --insecure -L "https://github.com/rxi/lite-colors/archive/master.zip" -o "$build/rxi-lite-colors.zip" || exit 1
mkdir -p "$build/third/data/colors" "$build/third/data/plugins"
unzip -qq "$build/rxi-lite-colors.zip" -d "$build"
mv "$build/lite-colors-master/colors" "$build/third/data"
@ -36,15 +36,17 @@ while [ ! -z ${1+x} ]; do
esac
done
wget="wget --retry-connrefused --waitretry=1 --read-timeout=20 --no-check-certificate"
workdir=".repackage"
rm -fr "$workdir" && mkdir "$workdir" && pushd "$workdir"
fetch_packages_from_github () {
assets=($(wget --no-check-certificate -q -nv -O- https://api.github.com/repos/franko/lite-xl/releases/latest | grep "browser_download_url" | cut -d '"' -f 4))
assets=($($wget -q -nv -O- https://api.github.com/repos/franko/lite-xl/releases/latest | grep "browser_download_url" | cut -d '"' -f 4))
for url in "${assets[@]}"; do
echo "getting: $url"
wget -q --no-check-certificate "$url"
$wget -q "$url" || exit 1
done
}