Compare commits
7 Commits
amiga2.1
...
39f4ebe210
Author | SHA1 | Date |
---|---|---|
Francesco Abbate | 39f4ebe210 | |
Francesco Abbate | 86f2cefde8 | |
Francesco Abbate | 10d4f0a53a | |
Francesco Abbate | 96b7e68c67 | |
Francesco Abbate | de1db14d4a | |
Francesco Abbate | c9d4f6fab3 | |
Francesco Abbate | d1017895eb |
|
@ -0,0 +1,28 @@
|
|||
local style = require "core.style"
|
||||
local common = require "core.common"
|
||||
|
||||
style.background = { common.color "#282828" }
|
||||
style.background2 = { common.color "#1d2021" }
|
||||
style.background3 = { common.color "#1d2021" }
|
||||
style.text = { common.color "#928374" }
|
||||
style.caret = { common.color "#fbf1c7" }
|
||||
style.accent = { common.color "#ebdbb2" }
|
||||
style.dim = { common.color "#928374" }
|
||||
style.divider = { common.color "#665c54" }
|
||||
style.selection = { common.color "#3c3836" }
|
||||
style.line_number = { common.color "#928374" }
|
||||
style.line_number2 = { common.color "#ebdbb2" }
|
||||
style.line_highlight = { common.color "#32302f" }
|
||||
style.scrollbar = { common.color "#928374" }
|
||||
style.scrollbar2 = { common.color "#fbf1c7" }
|
||||
|
||||
style.syntax["normal"] = { common.color "#ebdbb2" }
|
||||
style.syntax["symbol"] = { common.color "#ebdbb2" }
|
||||
style.syntax["comment"] = { common.color "#928374" }
|
||||
style.syntax["keyword"] = { common.color "#fb4934" }
|
||||
style.syntax["keyword2"] = { common.color "#83a598" }
|
||||
style.syntax["number"] = { common.color "#d3869b" }
|
||||
style.syntax["literal"] = { common.color "#d3869b" }
|
||||
style.syntax["string"] = { common.color "#b8bb26" }
|
||||
style.syntax["operator"] = { common.color "#ebdbb2" }
|
||||
style.syntax["function"] = { common.color "#8ec07c" }
|
|
@ -0,0 +1,31 @@
|
|||
-- Based on gruvbox color theme:
|
||||
-- https://github.com/morhetz/gruvbox
|
||||
|
||||
local style = require "core.style"
|
||||
local common = require "core.common"
|
||||
|
||||
style.background = { common.color "#fbf1c7" }
|
||||
style.background2 = { common.color "#f2e5bc" }
|
||||
style.background3 = { common.color "#eddbb2" }
|
||||
style.text = { common.color "#928374" }
|
||||
style.caret = { common.color "#282828" }
|
||||
style.accent = { common.color "#3c3836" }
|
||||
style.dim = { common.color "#928374" }
|
||||
style.divider = { common.color "#bdae93" }
|
||||
style.selection = { common.color "#ebdbb2" }
|
||||
style.line_number = { common.color "#928374" }
|
||||
style.line_number2 = { common.color "#3c3836" }
|
||||
style.line_highlight = { common.color "#f2e5bc" }
|
||||
style.scrollbar = { common.color "#928374" }
|
||||
style.scrollbar2 = { common.color "#504945" }
|
||||
|
||||
style.syntax["normal"] = { common.color "#3c3836" }
|
||||
style.syntax["symbol"] = { common.color "#3c3836" }
|
||||
style.syntax["comment"] = { common.color "#928374" }
|
||||
style.syntax["keyword"] = { common.color "#cc241d" }
|
||||
style.syntax["keyword2"] = { common.color "#458588" }
|
||||
style.syntax["number"] = { common.color "#b16286" }
|
||||
style.syntax["literal"] = { common.color "#b16286" }
|
||||
style.syntax["string"] = { common.color "#98971a" }
|
||||
style.syntax["operator"] = { common.color "#3c3836" }
|
||||
style.syntax["function"] = { common.color "#689d6a" }
|
|
@ -147,6 +147,12 @@ local function compile_ignore_files()
|
|||
end
|
||||
|
||||
|
||||
local function safe_match(s, pattern)
|
||||
local ok, match = pcall(string.match, s, pattern)
|
||||
return ok and match
|
||||
end
|
||||
|
||||
|
||||
local function fileinfo_pass_filter(info, ignore_compiled)
|
||||
if info.size >= config.file_size_limit * 1e6 then return false end
|
||||
local basename = common.basename(info.filename)
|
||||
|
@ -155,11 +161,11 @@ local function fileinfo_pass_filter(info, ignore_compiled)
|
|||
for _, compiled in ipairs(ignore_compiled) do
|
||||
local test = compiled.use_path and fullname or basename
|
||||
if compiled.match_dir then
|
||||
if info.type == "dir" and string.match(test .. "/", compiled.pattern) then
|
||||
if info.type == "dir" and safe_match(test .. "/", compiled.pattern) then
|
||||
return false
|
||||
end
|
||||
else
|
||||
if string.match(test, compiled.pattern) then
|
||||
if safe_match(test, compiled.pattern) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
@ -847,8 +853,9 @@ local function add_config_files_hooks()
|
|||
local doc_save = Doc.save
|
||||
local user_filename = system.absolute_path(USERDIR .. PATHSEP .. "init.lua")
|
||||
function Doc:save(filename, abs_filename)
|
||||
local module_filename = system.absolute_path(".lite_project.lua")
|
||||
doc_save(self, filename, abs_filename)
|
||||
if self.abs_filename == user_filename or self.abs_filename == core.project_module_filename then
|
||||
if self.abs_filename == user_filename or self.abs_filename == module_filename then
|
||||
reload_customizations()
|
||||
rescan_project_directories()
|
||||
configure_borderless_window()
|
||||
|
@ -1163,7 +1170,6 @@ end
|
|||
|
||||
function core.load_project_module()
|
||||
local filename = ".lite_project.lua"
|
||||
core.project_module_filename = system.absolute_path(filename)
|
||||
if system.get_file_info(filename) then
|
||||
return core.try(function()
|
||||
local fn, err = loadfile(filename)
|
||||
|
|
|
@ -346,11 +346,20 @@ function Node:get_child_overlapping_point(x, y)
|
|||
end
|
||||
|
||||
|
||||
-- returns: total height, text padding, top margin
|
||||
local function get_tab_y_sizes()
|
||||
local h = style.font:get_height()
|
||||
local pad = style.padding.y
|
||||
local margin = style.divider_size -- top margin
|
||||
return h + 2 * pad + margin, pad, margin
|
||||
end
|
||||
|
||||
|
||||
function Node:get_scroll_button_rect(index)
|
||||
local w, pad = get_scroll_button_width()
|
||||
local h = style.font:get_height() + style.padding.y * 2
|
||||
local w, pad_x = get_scroll_button_width()
|
||||
local h = get_tab_y_sizes()
|
||||
local x = self.position.x + (index == 1 and 0 or self.size.x - w)
|
||||
return x, self.position.y, w, h, pad
|
||||
return x, self.position.y, w, h, pad_x
|
||||
end
|
||||
|
||||
|
||||
|
@ -360,8 +369,8 @@ function Node:get_tab_rect(idx)
|
|||
local x0 = self.position.x + sbw
|
||||
local x1 = x0 + common.clamp(self.tab_width * (idx - 1) - self.tab_shift, 0, maxw)
|
||||
local x2 = x0 + common.clamp(self.tab_width * idx - self.tab_shift, 0, maxw)
|
||||
local h = style.font:get_height() + style.padding.y * 2
|
||||
return x1, self.position.y, x2 - x1, h
|
||||
local h, pad_y, margin_y = get_tab_y_sizes()
|
||||
return x1, self.position.y, x2 - x1, h, margin_y
|
||||
end
|
||||
|
||||
|
||||
|
@ -520,22 +529,24 @@ function Node:draw_tab(text, is_active, is_hovered, is_close_hovered, x, y, w, h
|
|||
local ds = style.divider_size
|
||||
local dots_width = style.font:get_width("…")
|
||||
local color = style.dim
|
||||
local padding_y = style.padding.y
|
||||
local _, padding_y, margin_y = get_tab_y_sizes()
|
||||
renderer.draw_rect(x + w, y + padding_y, ds, h - padding_y * 2, style.dim)
|
||||
if standalone then
|
||||
renderer.draw_rect(x-1, y-1, w+2, h+2, style.background2)
|
||||
renderer.draw_rect(x-1, y + margin_y - 1, w+2, h - margin_y + 2, style.background2)
|
||||
end
|
||||
local y_label, h_label = y + margin_y, h - margin_y
|
||||
if is_active then
|
||||
color = style.text
|
||||
renderer.draw_rect(x, y, w, h, style.background)
|
||||
renderer.draw_rect(x + w, y, ds, h, style.divider)
|
||||
renderer.draw_rect(x - ds, y, ds, h, style.divider)
|
||||
renderer.draw_rect(x, y_label, w, h_label, style.background)
|
||||
renderer.draw_rect(x, y_label, w, ds, style.divider)
|
||||
renderer.draw_rect(x + w, y_label, ds, h_label, style.divider)
|
||||
renderer.draw_rect(x - ds, y_label, ds, h_label, style.divider)
|
||||
end
|
||||
local cx, cw, cspace = close_button_location(x, w)
|
||||
local show_close_button = ((is_active or is_hovered) and not standalone and config.tab_close_button)
|
||||
if show_close_button then
|
||||
local close_style = is_close_hovered and style.text or style.dim
|
||||
common.draw_text(style.icon_font, close_style, "C", nil, cx, y, 0, h)
|
||||
common.draw_text(style.icon_font, close_style, "C", nil, cx, y_label, 0, h_label)
|
||||
end
|
||||
if is_hovered then
|
||||
color = style.text
|
||||
|
@ -560,7 +571,7 @@ function Node:draw_tab(text, is_active, is_hovered, is_close_hovered, x, y, w, h
|
|||
end
|
||||
end
|
||||
end
|
||||
common.draw_text(style.font, color, text, align, x, y, w, h)
|
||||
common.draw_text(style.font, color, text, align, x, y_label, w, h_label)
|
||||
core.pop_clip_rect()
|
||||
end
|
||||
|
||||
|
@ -760,7 +771,7 @@ function Node:get_drag_overlay_tab_position(x, y, dragged_node, dragged_index)
|
|||
tab_index = self:get_visible_tabs_number() + (self.tab_offset - 1 or 0)
|
||||
end
|
||||
end
|
||||
local tab_x, tab_y, tab_w, tab_h = self:get_tab_rect(tab_index)
|
||||
local tab_x, tab_y, tab_w, tab_h, margin_y = self:get_tab_rect(tab_index)
|
||||
if x > tab_x + tab_w / 2 and tab_index <= #self.views then
|
||||
-- use next tab
|
||||
tab_x = tab_x + tab_w
|
||||
|
@ -771,7 +782,7 @@ function Node:get_drag_overlay_tab_position(x, y, dragged_node, dragged_index)
|
|||
tab_index = tab_index - 1
|
||||
tab_x = tab_x - tab_w
|
||||
end
|
||||
return tab_index, tab_x, tab_y, tab_w, tab_h
|
||||
return tab_index, tab_x, tab_y + margin_y, tab_w, tab_h - margin_y
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -159,10 +159,6 @@ DMON_API_DECL void dmon_unwatch(dmon_watch_id id);
|
|||
# define NOMINMAX
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# include <intrin.h>
|
||||
# ifdef _MSC_VER
|
||||
# pragma intrinsic(_InterlockedExchange)
|
||||
# endif
|
||||
#elif DMON_OS_LINUX
|
||||
# ifndef __USE_MISC
|
||||
# define __USE_MISC
|
||||
|
@ -406,7 +402,8 @@ typedef struct dmon__state {
|
|||
dmon__watch_state watches[DMON_MAX_WATCHES];
|
||||
HANDLE thread_handle;
|
||||
CRITICAL_SECTION mutex;
|
||||
volatile LONG modify_watches;
|
||||
volatile int modify_watches;
|
||||
CRITICAL_SECTION modify_watches_mutex;
|
||||
dmon__win32_event* events;
|
||||
bool quit;
|
||||
HANDLE wake_event;
|
||||
|
@ -492,6 +489,13 @@ _DMON_PRIVATE void dmon__win32_process_events(void)
|
|||
stb_sb_reset(_dmon.events);
|
||||
}
|
||||
|
||||
static int dmon__safe_get_modify_watches() {
|
||||
EnterCriticalSection(&_dmon.modify_watches_mutex);
|
||||
const int value = _dmon.modify_watches;
|
||||
LeaveCriticalSection(&_dmon.modify_watches_mutex);
|
||||
return value;
|
||||
}
|
||||
|
||||
_DMON_PRIVATE DWORD WINAPI dmon__thread(LPVOID arg)
|
||||
{
|
||||
_DMON_UNUSED(arg);
|
||||
|
@ -502,7 +506,8 @@ _DMON_PRIVATE DWORD WINAPI dmon__thread(LPVOID arg)
|
|||
uint64_t msecs_elapsed = 0;
|
||||
|
||||
while (!_dmon.quit) {
|
||||
if (_dmon.modify_watches || !TryEnterCriticalSection(&_dmon.mutex)) {
|
||||
if (dmon__safe_get_modify_watches() ||
|
||||
!TryEnterCriticalSection(&_dmon.mutex)) {
|
||||
Sleep(10);
|
||||
continue;
|
||||
}
|
||||
|
@ -587,6 +592,7 @@ DMON_API_IMPL void dmon_init(void)
|
|||
{
|
||||
DMON_ASSERT(!_dmon_init);
|
||||
InitializeCriticalSection(&_dmon.mutex);
|
||||
InitializeCriticalSection(&_dmon.modify_watches_mutex);
|
||||
|
||||
_dmon.thread_handle =
|
||||
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)dmon__thread, NULL, 0, NULL);
|
||||
|
@ -596,11 +602,20 @@ DMON_API_IMPL void dmon_init(void)
|
|||
}
|
||||
|
||||
static void dmon__enter_critical_wakeup(void) {
|
||||
_InterlockedExchange(&_dmon.modify_watches, 1);
|
||||
EnterCriticalSection(&_dmon.modify_watches_mutex);
|
||||
_dmon.modify_watches = 1;
|
||||
if (TryEnterCriticalSection(&_dmon.mutex) == 0) {
|
||||
SetEvent(_dmon.wake_event);
|
||||
EnterCriticalSection(&_dmon.mutex);
|
||||
}
|
||||
LeaveCriticalSection(&_dmon.modify_watches_mutex);
|
||||
}
|
||||
|
||||
static void dmon__leave_critical_wakeup(void) {
|
||||
EnterCriticalSection(&_dmon.modify_watches_mutex);
|
||||
_dmon.modify_watches = 0;
|
||||
LeaveCriticalSection(&_dmon.modify_watches_mutex);
|
||||
LeaveCriticalSection(&_dmon.mutex);
|
||||
}
|
||||
|
||||
DMON_API_IMPL void dmon_deinit(void)
|
||||
|
@ -617,8 +632,9 @@ DMON_API_IMPL void dmon_deinit(void)
|
|||
dmon__unwatch(&_dmon.watches[i]);
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&_dmon.mutex);
|
||||
dmon__leave_critical_wakeup();
|
||||
DeleteCriticalSection(&_dmon.mutex);
|
||||
DeleteCriticalSection(&_dmon.modify_watches_mutex);
|
||||
stb_sb_free(_dmon.events);
|
||||
_dmon_init = false;
|
||||
}
|
||||
|
@ -665,19 +681,16 @@ DMON_API_IMPL dmon_watch_id dmon_watch(const char* rootdir,
|
|||
!dmon__refresh_watch(watch)) {
|
||||
dmon__unwatch(watch);
|
||||
*error_code = DMON_ERROR_WATCH_DIR;
|
||||
LeaveCriticalSection(&_dmon.mutex);
|
||||
_InterlockedExchange(&_dmon.modify_watches, 0);
|
||||
dmon__leave_critical_wakeup();
|
||||
return dmon__make_id(0);
|
||||
}
|
||||
} else {
|
||||
*error_code = DMON_ERROR_OPEN_DIR;
|
||||
LeaveCriticalSection(&_dmon.mutex);
|
||||
_InterlockedExchange(&_dmon.modify_watches, 0);
|
||||
dmon__leave_critical_wakeup();
|
||||
return dmon__make_id(0);
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&_dmon.mutex);
|
||||
_InterlockedExchange(&_dmon.modify_watches, 0);
|
||||
dmon__leave_critical_wakeup();
|
||||
return dmon__make_id(id);
|
||||
}
|
||||
|
||||
|
@ -696,8 +709,7 @@ DMON_API_IMPL void dmon_unwatch(dmon_watch_id id)
|
|||
}
|
||||
--_dmon.num_watches;
|
||||
|
||||
LeaveCriticalSection(&_dmon.mutex);
|
||||
_InterlockedExchange(&_dmon.modify_watches, 0);
|
||||
dmon__leave_critical_wakeup();
|
||||
}
|
||||
|
||||
#elif DMON_OS_LINUX
|
||||
|
@ -733,7 +745,8 @@ typedef struct dmon__state {
|
|||
int num_watches;
|
||||
pthread_t thread_handle;
|
||||
pthread_mutex_t mutex;
|
||||
int wait_flag;
|
||||
volatile int wait_flag;
|
||||
pthread_mutex_t wait_flag_mutex;
|
||||
int wake_event_pipe[2];
|
||||
bool quit;
|
||||
} dmon__state;
|
||||
|
@ -1013,6 +1026,13 @@ _DMON_PRIVATE void dmon__inotify_process_events(void)
|
|||
stb_sb_reset(_dmon.events);
|
||||
}
|
||||
|
||||
_DMON_PRIVATE int dmon__safe_get_wait_flag() {
|
||||
pthread_mutex_lock(&_dmon.wait_flag_mutex);
|
||||
const int value = _dmon.wait_flag;
|
||||
pthread_mutex_unlock(&_dmon.wait_flag_mutex);
|
||||
return value;
|
||||
}
|
||||
|
||||
static void* dmon__thread(void* arg)
|
||||
{
|
||||
_DMON_UNUSED(arg);
|
||||
|
@ -1028,7 +1048,9 @@ static void* dmon__thread(void* arg)
|
|||
|
||||
while (!_dmon.quit) {
|
||||
nanosleep(&req, &rem);
|
||||
if (_dmon.num_watches == 0 || _dmon.wait_flag == 1 || pthread_mutex_trylock(&_dmon.mutex) != 0) {
|
||||
if (_dmon.num_watches == 0 ||
|
||||
dmon__safe_get_wait_flag() ||
|
||||
pthread_mutex_trylock(&_dmon.mutex) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1106,6 +1128,7 @@ static void* dmon__thread(void* arg)
|
|||
}
|
||||
|
||||
_DMON_PRIVATE void dmon__mutex_wakeup_lock(void) {
|
||||
pthread_mutex_lock(&_dmon.wait_flag_mutex);
|
||||
_dmon.wait_flag = 1;
|
||||
if (pthread_mutex_trylock(&_dmon.mutex) != 0) {
|
||||
char send_char = 1;
|
||||
|
@ -1113,6 +1136,7 @@ _DMON_PRIVATE void dmon__mutex_wakeup_lock(void) {
|
|||
pthread_mutex_lock(&_dmon.mutex);
|
||||
}
|
||||
_dmon.wait_flag = 0;
|
||||
pthread_mutex_unlock(&_dmon.wait_flag_mutex);
|
||||
}
|
||||
|
||||
_DMON_PRIVATE void dmon__unwatch(dmon__watch_state* watch)
|
||||
|
|
|
@ -216,11 +216,11 @@ main() {
|
|||
rm -rf "Lite XL.app"; mv "${dest_dir}" "Lite XL.app"
|
||||
dest_dir="Lite XL.app"
|
||||
exe_file="$(pwd)/${dest_dir}/Contents/MacOS/lite-xl"
|
||||
data_dir="$(pwd)/${dest_dir}/Contents/Resources"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $bundle == false && $portable == false ]]; then
|
||||
echo "Creating a compressed archive..."
|
||||
data_dir="$(pwd)/${dest_dir}/$prefix/share/lite-xl"
|
||||
exe_file="$(pwd)/${dest_dir}/$prefix/bin/lite-xl"
|
||||
fi
|
||||
|
@ -240,6 +240,7 @@ main() {
|
|||
|
||||
$stripcmd "${exe_file}"
|
||||
|
||||
echo "Creating a compressed archive ${package_name}"
|
||||
if [[ $binary == true ]]; then
|
||||
rm -f "${package_name}".tar.gz
|
||||
rm -f "${package_name}".zip
|
||||
|
|
Loading…
Reference in New Issue