Redesign lua reloading and other generation stuff
This commit is contained in:
@@ -1,56 +1,3 @@
|
||||
Color GruvboxDark0Hard = {0x1d, 0x20, 0x21, 0xff};
|
||||
Color GruvboxDark0 = {0x28, 0x28, 0x28, 0xff};
|
||||
Color GruvboxDark0Soft = {0x32, 0x30, 0x2f, 0xff};
|
||||
Color GruvboxDark1 = {0x3c, 0x38, 0x36, 0xff};
|
||||
Color GruvboxDark2 = {0x50, 0x49, 0x45, 0xff};
|
||||
Color GruvboxDark3 = {0x66, 0x5c, 0x54, 0xff};
|
||||
Color GruvboxDark4 = {0x7c, 0x6f, 0x64, 0xff};
|
||||
Color GruvboxGray245 = {0x92, 0x83, 0x74, 0xff};
|
||||
Color GruvboxGray244 = {0x92, 0x83, 0x74, 0xff};
|
||||
Color GruvboxLight0Hard = {0xf9, 0xf5, 0xd7, 0xff};
|
||||
Color GruvboxLight0 = {0xfb, 0xf1, 0xc7, 0xff};
|
||||
Color GruvboxLight0Soft = {0xf2, 0xe5, 0xbc, 0xff};
|
||||
Color GruvboxLight1 = {0xeb, 0xdb, 0xb2, 0xff};
|
||||
Color GruvboxLight2 = {0xd5, 0xc4, 0xa1, 0xff};
|
||||
Color GruvboxLight3 = {0xbd, 0xae, 0x93, 0xff};
|
||||
Color GruvboxLight4 = {0xa8, 0x99, 0x84, 0xff};
|
||||
Color GruvboxBrightRed = {0xfb, 0x49, 0x34, 0xff};
|
||||
Color GruvboxBrightGreen = {0xb8, 0xbb, 0x26, 0xff};
|
||||
Color GruvboxBrightYellow = {0xfa, 0xbd, 0x2f, 0xff};
|
||||
Color GruvboxBrightBlue = {0x83, 0xa5, 0x98, 0xff};
|
||||
Color GruvboxBrightPurple = {0xd3, 0x86, 0x9b, 0xff};
|
||||
Color GruvboxBrightAqua = {0x8e, 0xc0, 0x7c, 0xff};
|
||||
Color GruvboxBrightOrange = {0xfe, 0x80, 0x19, 0xff};
|
||||
Color GruvboxNeutralRed = {0xcc, 0x24, 0x1d, 0xff};
|
||||
Color GruvboxNeutralGreen = {0x98, 0x97, 0x1a, 0xff};
|
||||
Color GruvboxNeutralYellow = {0xd7, 0x99, 0x21, 0xff};
|
||||
Color GruvboxNeutralBlue = {0x45, 0x85, 0x88, 0xff};
|
||||
Color GruvboxNeutralPurple = {0xb1, 0x62, 0x86, 0xff};
|
||||
Color GruvboxNeutralAqua = {0x68, 0x9d, 0x6a, 0xff};
|
||||
Color GruvboxNeutralOrange = {0xd6, 0x5d, 0x0e, 0xff};
|
||||
Color GruvboxFadedRed = {0x9d, 0x00, 0x06, 0xff};
|
||||
Color GruvboxFadedGreen = {0x79, 0x74, 0x0e, 0xff};
|
||||
Color GruvboxFadedYellow = {0xb5, 0x76, 0x14, 0xff};
|
||||
Color GruvboxFadedBlue = {0x07, 0x66, 0x78, 0xff};
|
||||
Color GruvboxFadedPurple = {0x8f, 0x3f, 0x71, 0xff};
|
||||
Color GruvboxFadedAqua = {0x42, 0x7b, 0x58, 0xff};
|
||||
Color GruvboxFadedOrange = {0xaf, 0x3a, 0x03, 0xff};
|
||||
Color ColorText = GruvboxDark0Hard;
|
||||
Color ColorBackground = GruvboxLight0Hard;
|
||||
Color ColorInactiveWindow = {0x00, 0x00, 0x00, 0x0F};
|
||||
Color ColorTextLineNumbers = GruvboxDark4;
|
||||
Color ColorLineHighlight = GruvboxLight0Soft;
|
||||
Color ColorMainCaret = GruvboxDark0Hard;
|
||||
Color ColorSubCaret = GruvboxGray245;
|
||||
Color ColorSelection = GruvboxLight1;
|
||||
Color ColorWhitespaceDuringSelection = GruvboxLight4;
|
||||
Color ColorFuzzySearchLineHighlight = GruvboxDark0;
|
||||
Color ColorScrollbarBackground = GruvboxLight2;
|
||||
Color ColorScrollbarScroller = GruvboxLight1;
|
||||
Color ColorScrollbarScrollerSelected = GruvboxLight0Hard;
|
||||
Color ColorTitleBarText = GruvboxDark2;
|
||||
Color ColorTitleBarBackground = GruvboxLight1;
|
||||
Color ColorTitleBarSelection = GruvboxLight3;
|
||||
String BaseLuaConfig = R"==(
|
||||
local GruvboxDark0Hard = 0x1d2021ff
|
||||
local GruvboxDark0 = 0x282828ff
|
||||
@@ -106,44 +53,13 @@ Color.ScrollbarScrollerSelected = GruvboxLight0Hard
|
||||
Color.TitleBarText = GruvboxDark2
|
||||
Color.TitleBarBackground = GruvboxLight1
|
||||
Color.TitleBarSelection = GruvboxLight3
|
||||
Style = {}
|
||||
Style.DrawLineNumbers = 0
|
||||
Style.DrawScrollbar = 0
|
||||
|
||||
-- @todo: should we rewrite linux paths to windows on windows and vice-versa?
|
||||
|
||||
function GenericTextFileRule(_s)
|
||||
function match_path(s)
|
||||
-- ./something
|
||||
-- add working directory
|
||||
local working_dir_i, working_dir_j = string.find(s, "^%./.+")
|
||||
if working_dir_j then
|
||||
result = s:sub(3)
|
||||
result = GetWorkingDir().."/"..result
|
||||
return result
|
||||
end
|
||||
|
||||
-- C:/something
|
||||
local abs_i, abs_j = string.find(s, "^%a:/.+")
|
||||
if abs_i then
|
||||
return s
|
||||
end
|
||||
|
||||
-- C:\something
|
||||
local abs_i, abs_j = s:find("^%a:\\.+")
|
||||
if abs_i then
|
||||
s = s:gsub("\\", "/")
|
||||
return s
|
||||
end
|
||||
|
||||
-- /mnt/something
|
||||
local abs_i, abs_j = s:find("^/.*")
|
||||
if abs_i then
|
||||
return s
|
||||
end
|
||||
|
||||
-- other_random_filename
|
||||
return s
|
||||
end
|
||||
|
||||
function match_line_col(s)
|
||||
function ExtractLineAndColumn(s)
|
||||
local line = 1
|
||||
local col = 1
|
||||
|
||||
@@ -205,16 +121,65 @@ function GenericTextFileRule(_s)
|
||||
end
|
||||
|
||||
return 0, 0, s
|
||||
end
|
||||
|
||||
function GenericTextFileRule(_s)
|
||||
function match_path(s)
|
||||
-- ./something
|
||||
-- add working directory
|
||||
local working_dir_i, working_dir_j = string.find(s, "^%./.+")
|
||||
if working_dir_j then
|
||||
result = s:sub(3)
|
||||
result = GetWorkingDir().."/"..result
|
||||
return result
|
||||
end
|
||||
|
||||
-- C:/something
|
||||
local abs_i, abs_j = string.find(s, "^%a:/.+")
|
||||
if abs_i then
|
||||
return s
|
||||
end
|
||||
|
||||
-- C:\something
|
||||
local abs_i, abs_j = s:find("^%a:\\.+")
|
||||
if abs_i then
|
||||
s = s:gsub("\\", "/")
|
||||
return s
|
||||
end
|
||||
|
||||
-- /mnt/something
|
||||
local abs_i, abs_j = s:find("^/.*")
|
||||
if abs_i then
|
||||
return s
|
||||
end
|
||||
|
||||
-- other_random_filename
|
||||
return s
|
||||
end
|
||||
|
||||
line, col, _s = match_line_col(_s)
|
||||
line, col, _s = ExtractLineAndColumn(_s)
|
||||
file_path = match_path(_s)
|
||||
return {kind = "text", file_path = file_path, line = line, col = col}
|
||||
end
|
||||
|
||||
-- function RuleFindExistingBuffer(_s)
|
||||
-- line, col, _s = ExtractLineAndColumn(_s)
|
||||
--
|
||||
-- buffers = list_buffers_object()
|
||||
-- for i = 1,#buffers do
|
||||
-- buff = buffers[i]
|
||||
-- if buff == _s then
|
||||
-- return {kind = "text", file_path = buff, line = line, col = col}
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- return nil
|
||||
-- end
|
||||
|
||||
|
||||
Rules = {}
|
||||
Rules[#Rules + 1] = GenericTextFileRule
|
||||
-- Rules[#Rules + 2] = RuleFindExistingBuffer
|
||||
|
||||
function ApplyRules(s)
|
||||
for i = #Rules,1,-1 do
|
||||
@@ -229,7 +194,7 @@ end
|
||||
|
||||
|
||||
)==";
|
||||
void ReloadColors() {
|
||||
void ReloadStyle() {
|
||||
ColorText = GetColor("Text", ColorText);
|
||||
ColorBackground = GetColor("Background", ColorBackground);
|
||||
ColorInactiveWindow = GetColor("InactiveWindow", ColorInactiveWindow);
|
||||
@@ -246,4 +211,6 @@ void ReloadColors() {
|
||||
ColorTitleBarText = GetColor("TitleBarText", ColorTitleBarText);
|
||||
ColorTitleBarBackground = GetColor("TitleBarBackground", ColorTitleBarBackground);
|
||||
ColorTitleBarSelection = GetColor("TitleBarSelection", ColorTitleBarSelection);
|
||||
StyleDrawLineNumbers = GetStyle("DrawLineNumbers", StyleDrawLineNumbers);
|
||||
StyleDrawScrollbar = GetStyle("DrawScrollbar", StyleDrawScrollbar);
|
||||
}
|
||||
Reference in New Issue
Block a user