From 9412b3f0d871ab9bc8f491cbb6db3cba490ec041 Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Wed, 13 Jan 2021 17:09:35 +0100 Subject: [PATCH 1/6] Do not add project path in files from project search --- data/plugins/projectsearch.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/plugins/projectsearch.lua b/data/plugins/projectsearch.lua index 50cd3c4a..22c16ef8 100644 --- a/data/plugins/projectsearch.lua +++ b/data/plugins/projectsearch.lua @@ -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 From c2cccf0173dc856c1ae9edca66834062dee986b6 Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Tue, 19 Jan 2021 16:39:15 +0100 Subject: [PATCH 2/6] Fix conflict in treeview for top directories Happened if a filename has the same name of a top directory. It will cause a collision in the string to identify the entry into the cache. --- data/plugins/treeview.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/data/plugins/treeview.lua b/data/plugins/treeview.lua index 71ea9869..08ec94ad 100644 --- a/data/plugins/treeview.lua +++ b/data/plugins/treeview.lua @@ -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 From 0d6fbe23c4279e148b006b2f6fc4caafee61f2ed Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Wed, 20 Jan 2021 15:41:12 +0100 Subject: [PATCH 3/6] Add curl option to retry download in repackage script --- dev-utils/repackage.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dev-utils/repackage.sh b/dev-utils/repackage.sh index d3d40ba3..99368582 100644 --- a/dev-utils/repackage.sh +++ b/dev-utils/repackage.sh @@ -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 } From 65c7f666aab1a8839cb75660f694dd0561e29099 Mon Sep 17 00:00:00 2001 From: B14CK313 Date: Fri, 22 Jan 2021 02:10:24 +0100 Subject: [PATCH 4/6] Fixed path returned by temp_filename not writeable The path returned by temp_filename was not writeable on UNIX (and possibly other OS). This lead to the gitstatus plugin not working. The proposed change fixes this by using the USERDIR variable instead of EXEDIR --- data/core/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/core/init.lua b/data/core/init.lua index f022f5e2..29a1db0d 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -443,7 +443,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 From 03818d13fdd966a932ce253d5a4e737638c5ead0 Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Wed, 3 Feb 2021 07:39:35 +0100 Subject: [PATCH 5/6] Fix error when using relative dir argument --- data/core/init.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/data/core/init.lua b/data/core/init.lua index 29a1db0d..07031b00 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -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) +function core.open_folder_project(dir_path_abs) if core.set_project_dir(dirname, 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 @@ -364,7 +364,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(".") From 3d8cf22933fed27b632765a08e7b25e853dcbbd1 Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Fri, 5 Feb 2021 15:36:48 +0100 Subject: [PATCH 6/6] Fix error with previous commit --- data/core/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/core/init.lua b/data/core/init.lua index 07031b00..60a39d89 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -75,7 +75,7 @@ end function core.open_folder_project(dir_path_abs) - if core.set_project_dir(dirname, core.on_quit_project) then + if core.set_project_dir(dir_path_abs, core.on_quit_project) then core.root_view:close_all_docviews() add_project_to_recents(dir_path_abs) core.on_enter_project(dir_path_abs)