editor sync

main
Dominik Madarász 2023-11-06 09:55:10 +01:00
parent 6e39436792
commit 8feb515d33
32 changed files with 2046 additions and 149 deletions

View File

@ -109,6 +109,7 @@ char* lt_key_name(char *dst, int key, int vk, int mods) {
if( key == GLFW_KEY_RIGHT_CONTROL ) return "right ctrl";
if( key == GLFW_KEY_LEFT_SUPER ) return "left windows";
if( key == GLFW_KEY_RIGHT_SUPER ) return "left windows";
if( key == GLFW_KEY_MENU ) return "menu";
if( key == GLFW_KEY_ESCAPE ) return "escape";
if( key == GLFW_KEY_BACKSPACE ) return "backspace";

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

View File

@ -0,0 +1,2 @@
Free & Open Sourced Logos
At Fairpixels, we had unused logo designs piling up on our hard drives and decided to make them available to the world, for free. The logos below can be downloaded unlimited times and used by anyone. For personal & commercial projects. No attribution required. Perfect for mvp's and mockups.

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -0,0 +1,14 @@
https://uxwing.com/license/
Permitted:
- All icons on UXWing free to download, and use personal, commercial projects.
- Attribution and Credit is NOT required, however, any credit will be much appreciated.
- There is no limit to the number of times you can use.
- You may modify the resources according to your requirements.
Brand icons:
- All brand logos /icons are trademarks of their respective owners/entities. This should only be used to represent the company or product to which they refer.
Prohibitions:
- Resell, Direct redistribute, Sub-license, Claim credit, or Ownership of any of the icons.
- Dont use this material for SPAM websites, illegal business, illegal activity, and hate/crime.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 122.88 122.88"><title>scale-ruler</title><path d="M91.87.85,122,31a2.94,2.94,0,0,1,.35.44,2.82,2.82,0,0,1,.49,1.6,2.85,2.85,0,0,1-.84,2l-87,87a3,3,0,0,1-.54.41,2.77,2.77,0,0,1-1.49.43,2.9,2.9,0,0,1-2-.84L.84,91.88a2.89,2.89,0,0,1,0-4.07l87-87a2.88,2.88,0,0,1,2-.84,2.82,2.82,0,0,1,2,.85ZM37.27,112.23l-7.91-7.91,3.8-3.8,7.91,7.91,4.25-4.25L31,89.84l3.8-3.8,14.34,14.34,4.25-4.24-7.91-7.92,3.8-3.8,7.91,7.91,4.25-4.24L47.07,73.74l3.8-3.8L65.22,84.29,69.47,80l-7.91-7.91,3.8-3.8,7.91,7.91L77.52,72,63.17,57.64l3.8-3.8L81.32,68.19l4.24-4.25L77.65,56l3.8-3.8,7.91,7.91,4.25-4.25L79.27,41.55l3.8-3.8L97.41,52.09,116.47,33,89.84,6.41,6.41,89.84,33,116.47l4.23-4.24ZM98,28.56a3.69,3.69,0,0,0-3.69-3.69,3.69,3.69,0,0,0-2.61,6.3l.08.09a3.71,3.71,0,0,0,5.14-.09l.08-.08a3.68,3.68,0,0,0,1-2.53Zm1.71-5.4a7.63,7.63,0,0,1,.12,10.68l-.12.13A7.64,7.64,0,0,1,89,34.08L88.91,34a7.64,7.64,0,0,1,10.81-10.8Z"/></svg>

After

Width:  |  Height:  |  Size: 983 B

View File

@ -0,0 +1,61 @@
local syntax = require "core.syntax"
-- batch syntax for lite <liqube>
-- windows batch files use caseless matching for symbols
local symtable = {
["keyword"] = {
"if", "else", "elsif", "not", "for", "do", "in",
"equ", "neq", "lss", "leq", "gtr", "geq", -- == != < <= > >=
"nul", "con", "prn", "prn", "lpt1", "com1", "com2", "com3", "com4",
"exist", "defined",
"errorlevel", "cmdextversion",
"goto", "call", "verify",
},
["function"] = {
"set", "setlocal", "endlocal", "enabledelayedexpansion",
"echo", "type",
"cd", "chdir",
"md", "mkdir",
"pause", "choice", "exit",
"del", "rd", "rmdir",
"copy", "xcopy",
"move", "ren",
"find", "findstr",
"sort", "shift", "attrib",
"cmd", "command",
"forfiles",
},
}
-- prepare a mixed symbol list
local function prepare_symbols(symtable)
local symbols = { }
for symtype, symlist in pairs(symtable) do
for _, symname in ipairs(symlist) do
symbols[symname:lower()] = symtype
symbols[symname:upper()] = symtype
end
end
return symbols
end
syntax.add {
files = { "%.bat$", "%.cmd$" },
comment = "rem",
patterns = {
{ pattern = "@echo off\n", type = "keyword" },
{ pattern = "@echo on\n", type = "keyword" },
{ pattern = "rem.-\n", type = "comment" }, -- rem comment line, rem, rem.
{ pattern = "REM.-\n", type = "comment" },
{ pattern = "%s*:[%w%-]+", type = "symbol" }, -- :labels
{ pattern = "%:%:.-\n", type = "comment" }, -- :: comment line
{ pattern = "%%%w+%%", type = "symbol" }, -- %variable%
{ pattern = "%%%%?~?[%w:]+", type = "symbol" }, -- %1, %~dpn1, %~1:2, %%i, %%~i
{ pattern = "[!=()%>&%^/\\@]", type = "operator" }, -- operators
{ pattern = "-?%.?%d+f?", type = "number" }, -- integer numbers
{ pattern = { '"', '"', '\\' }, type = "string" }, -- "strings"
{ pattern = "[%a_][%w_]*", type = "normal" },
{ pattern = ":eof", type = "keyword" }, -- not quite as intended, but ok for now
},
symbols = prepare_symbols(symtable),
}

View File

@ -0,0 +1,61 @@
local syntax = require "core.syntax"
-- batch syntax for lite <liqube>
-- windows batch files use caseless matching for symbols
local symtable = {
["keyword"] = {
"if", "else", "elsif", "not", "for", "do", "in",
"equ", "neq", "lss", "leq", "gtr", "geq", -- == != < <= > >=
"nul", "con", "prn", "prn", "lpt1", "com1", "com2", "com3", "com4",
"exist", "defined",
"errorlevel", "cmdextversion",
"goto", "call", "verify",
},
["function"] = {
"set", "setlocal", "endlocal", "enabledelayedexpansion",
"echo", "type",
"cd", "chdir",
"md", "mkdir",
"pause", "choice", "exit",
"del", "rd", "rmdir",
"copy", "xcopy",
"move", "ren",
"find", "findstr",
"sort", "shift", "attrib",
"cmd", "command",
"forfiles",
},
}
-- prepare a mixed symbol list
local function prepare_symbols(symtable)
local symbols = { }
for symtype, symlist in pairs(symtable) do
for _, symname in ipairs(symlist) do
symbols[symname:lower()] = symtype
symbols[symname:upper()] = symtype
end
end
return symbols
end
syntax.add {
files = { "%.bat$", "%.cmd$" },
comment = "rem",
patterns = {
{ pattern = "@echo off\n", type = "keyword" },
{ pattern = "@echo on\n", type = "keyword" },
{ pattern = "rem.-\n", type = "comment" }, -- rem comment line, rem, rem.
{ pattern = "REM.-\n", type = "comment" },
{ pattern = "%s*:[%w%-]+", type = "symbol" }, -- :labels
{ pattern = "%:%:.-\n", type = "comment" }, -- :: comment line
{ pattern = "%%%w+%%", type = "symbol" }, -- %variable%
{ pattern = "%%%%?~?[%w:]+", type = "symbol" }, -- %1, %~dpn1, %~1:2, %%i, %%~i
{ pattern = "[!=()%>&%^/\\@]", type = "operator" }, -- operators
{ pattern = "-?%.?%d+f?", type = "number" }, -- integer numbers
{ pattern = { '"', '"', '\\' }, type = "string" }, -- "strings"
{ pattern = "[%a_][%w_]*", type = "normal" },
{ pattern = ":eof", type = "keyword" }, -- not quite as intended, but ok for now
},
symbols = prepare_symbols(symtable),
}

View File

@ -0,0 +1,121 @@
pcall(require, "plugins.language_c")
local syntax = require "core.syntax"
syntax.add {
files = {
"%.h$", "%.inl$", "%.cpp$", "%.cc$", "%.C$", "%.cxx$",
"%.c++$", "%.hh$", "%.H$", "%.hxx$", "%.hpp$", "%.h++$"
},
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { "#", "[^\\]\n" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["alignof"] = "keyword",
["alignas"] = "keyword",
["and"] = "keyword",
["and_eq"] = "keyword",
["not"] = "keyword",
["not_eq"] = "keyword",
["or"] = "keyword",
["or_eq"] = "keyword",
["xor"] = "keyword",
["xor_eq"] = "keyword",
["private"] = "keyword",
["protected"] = "keyword",
["public"] = "keyword",
["register"] = "keyword",
["nullptr"] = "keyword",
["operator"] = "keyword",
["asm"] = "keyword",
["bitand"] = "keyword",
["bitor"] = "keyword",
["catch"] = "keyword",
["throw"] = "keyword",
["try"] = "keyword",
["class"] = "keyword",
["compl"] = "keyword",
["explicit"] = "keyword",
["export"] = "keyword",
["concept"] = "keyword",
["consteval"] = "keyword",
["constexpr"] = "keyword",
["constinit"] = "keyword",
["const_cast"] = "keyword",
["dynamic_cast"] = "keyword",
["reinterpret_cast"] = "keyword",
["static_cast"] = "keyword",
["static_assert"] = "keyword",
["template"] = "keyword",
["this"] = "keyword",
["thread_local"] = "keyword",
["requires"] = "keyword",
["co_wait"] = "keyword",
["co_return"] = "keyword",
["co_yield"] = "keyword",
["decltype"] = "keyword",
["delete"] = "keyword",
["export"] = "keyword",
["friend"] = "keyword",
["typeid"] = "keyword",
["typename"] = "keyword",
["mutable"] = "keyword",
["virtual"] = "keyword",
["using"] = "keyword",
["namespace"] = "keyword",
["new"] = "keyword",
["noexcept"] = "keyword",
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["do"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["return"] = "keyword",
["goto"] = "keyword",
["struct"] = "keyword",
["union"] = "keyword",
["typedef"] = "keyword",
["enum"] = "keyword",
["extern"] = "keyword",
["static"] = "keyword",
["volatile"] = "keyword",
["const"] = "keyword",
["inline"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["default"] = "keyword",
["auto"] = "keyword",
["const"] = "keyword",
["void"] = "keyword",
["int"] = "keyword2",
["short"] = "keyword2",
["long"] = "keyword2",
["float"] = "keyword2",
["double"] = "keyword2",
["char"] = "keyword2",
["unsigned"] = "keyword2",
["bool"] = "keyword2",
["true"] = "keyword2",
["false"] = "keyword2",
["wchar_t"] = "keyword2",
["char8_t"] = "keyword2",
["char16_t"] = "keyword2",
["char32_t"] = "keyword2",
["NULL"] = "literal",
},
}

View File

@ -0,0 +1,119 @@
local syntax = require "core.syntax"
syntax.add {
files = "%.cs$",
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "[%$%@]?\"", '"', '\\' }, type = "string" }, -- string interpolation and verbatim
{ pattern = "'\\x%x?%x?%x?%x'", type = "string" }, -- character hexadecimal escape sequence
{ pattern = "'\\u%x%x%x%x'", type = "string" }, -- character unicode escape sequence
{ pattern = "'\\?.'", type = "string" }, -- character literal
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "%?%?", type = "operator" }, -- ?? null-coalescing
{ pattern = "%?%.", type = "operator" }, -- ?. null-conditional
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
-- keywords and contextual keywords
["abstract"] = "keyword",
["as"] = "keyword",
["add"] = "keyword",
["await"] = "keyword",
["base"] = "keyword",
["break"] = "keyword",
["case"] = "keyword",
["catch"] = "keyword",
["checked"] = "keyword",
["class"] = "keyword",
["record"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
["default"] = "keyword",
["delegate"] = "keyword",
["do"] = "keyword",
["else"] = "keyword",
["enum"] = "keyword",
["event"] = "keyword",
["explicit"] = "keyword",
["extern"] = "keyword",
["finally"] = "keyword",
["fixed"] = "keyword",
["for"] = "keyword",
["foreach"] = "keyword",
["get"] = "keyword",
["goto"] = "keyword",
["if"] = "keyword",
["implicit"] = "keyword",
["in"] = "keyword",
["interface"] = "keyword",
["internal"] = "keyword",
["is"] = "keyword",
["lock"] = "keyword",
["namespace"] = "keyword",
["new"] = "keyword",
["operator"] = "keyword",
["out"] = "keyword",
["override"] = "keyword",
["remove"] = "keyword",
["params"] = "keyword",
["partial"] = "keyword",
["private"] = "keyword",
["protected"] = "keyword",
["dynamic"] = "keyword",
["public"] = "keyword",
["readonly"] = "keyword",
["ref"] = "keyword",
["return"] = "keyword",
["sealed"] = "keyword",
["set"] = "keyword",
["sizeof"] = "keyword",
["stackalloc"] = "keyword",
["static"] = "keyword",
["struct"] = "keyword",
["switch"] = "keyword",
["this"] = "keyword",
["throw"] = "keyword",
["try"] = "keyword",
["typeof"] = "keyword",
["unchecked"] = "keyword",
["unsafe"] = "keyword",
["using"] = "keyword",
["var"] = "keyword",
["value"] = "keyword",
["global"] = "keyword",
["virtual"] = "keyword",
["void"] = "keyword",
["volatile"] = "keyword",
["where"] = "keyword",
["when"] = "keyword",
["while"] = "keyword",
["yield"] = "keyword",
-- types
["bool"] = "keyword2",
["byte"] = "keyword2",
["char"] = "keyword2",
["decimal"] = "keyword2",
["double"] = "keyword2",
["float"] = "keyword2",
["int"] = "keyword2",
["long"] = "keyword2",
["object"] = "keyword2",
["sbyte"] = "keyword2",
["short"] = "keyword2",
["string"] = "keyword2",
["uint"] = "keyword2",
["ulong"] = "keyword2",
["ushort"] = "keyword2",
-- literals
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
},
}

View File

@ -1,7 +1,11 @@
local style = require "core.style"
local common = require "core.common"
local syntax = require "core.syntax"
syntax.add {
files = { "%.fx$", "%.glsl$", "%.fs$", "%.vs$", "%.gs$" },
files = { "%.glsl$", "%.frag$", "%.vert$", "%.vs$", "%.fs$", "%.gs$", "%.fx$", },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
@ -13,55 +17,370 @@ syntax.add {
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "ivec[2-4]", type = "keyword2" },
{ pattern = "bvec[2-4]", type = "keyword2" },
{ pattern = "uvec[2-4]", type = "keyword2" },
{ pattern = "vec[2-4]", type = "keyword2" },
{ pattern = "dmat[2-4]x[2-4]", type = "keyword2" },
{ pattern = "dmat[2-4]", type = "keyword2" },
{ pattern = "mat[2-4]x[2-4]", type = "keyword2" },
{ pattern = "mat[2-4]", type = "keyword2" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
--https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.60.pdf
--The symbols are added here in the order they appear in the spec
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["do"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["return"] = "keyword",
["goto"] = "keyword",
["struct"] = "keyword",
["union"] = "keyword",
["typedef"] = "keyword",
["enum"] = "keyword",
["extern"] = "keyword",
["static"] = "keyword",
["volatile"] = "keyword",
["const"] = "keyword",
["inline"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["default"] = "keyword",
["auto"] = "keyword",
["const"] = "keyword",
["void"] = "keyword",
["uniform"] = "keyword",
["in"] = "keyword",
["out"] = "keyword",
["inout"] = "keyword",
["bool"] = "keyword2",
["int"] = "keyword2",
["short"] = "keyword2",
["long"] = "keyword2",
["uint"] = "keyword2",
["float"] = "keyword2",
["double"] = "keyword2",
["char"] = "keyword2",
["unsigned"] = "keyword2",
["bool"] = "keyword2",
["vec2"] = "keyword2",
["vec3"] = "keyword2",
["vec4"] = "keyword2",
["sampler2D"]= "keyword2",
["true"] = "literal",
["false"] = "literal",
["NULL"] = "literal",
["attribute"] = "keyword",
["varying"] = "keyword",
["uniform"] = "keyword",
["buffer"] = "keyword",
["shared"] = "keyword",
["layout"] = "keyword",
["centroid"] = "keyword",
["flat"] = "keyword",
["smooth"] = "keyword",
["noperspective"]= "keyword",
["patch"] = "keyword",
["sample"] = "keyword",
["in"] = "keyword",
["out"] = "keyword",
["inout"] = "keyword",
["invariant"] = "keyword",
["precise"] = "keyword",
["lowp"] = "keyword",
["mediump"] = "keyword",
["highp"] = "keyword",
["precision"] = "keyword",
["struct"] = "keyword",
["subroutine"] = "keyword",
["coherent"] = "keyword",
["volatile"] = "keyword",
["readonly"] = "keyword",
["writeonly"] = "keyword",
["sampler1D"] = "keyword2",
["sampler2D"] = "keyword2",
["sampler3D"] = "keyword2",
["samplerCube"] = "keyword2",
["sampler1DShadow"] = "keyword2",
["sampler2DShadow"] = "keyword2",
["samplerCubeShadow"] = "keyword2",
["sampler1DArray"] = "keyword2",
["sampler2DArray"] = "keyword2",
["samplerCubeArray"] = "keyword2",
["sampler1DArrayShadow"] = "keyword2",
["sampler2DArrayShadow"] = "keyword2",
["samplerCubeArrayShadow"]= "keyword2",
["isampler1D"] = "keyword2",
["isampler2D"] = "keyword2",
["isampler3D"] = "keyword2",
["isamplerCube"] = "keyword2",
["sampler2DMS"] = "keyword2",
["isampler2DMS"] = "keyword2",
["usampler2DMS"] = "keyword2",
["sampler2DMSArray"] = "keyword2",
["isampler2DMSArray"] = "keyword2",
["usampler2DMSArray"] = "keyword2",
["isampler1DArray"] = "keyword2",
["isampler2DArray"] = "keyword2",
["usampler1D"] = "keyword2",
["usampler2D"] = "keyword2",
["usampler3D"] = "keyword2",
["usamplerCube"] = "keyword2",
["usampler1DArray"] = "keyword2",
["usampler2DArray"] = "keyword2",
["sampler2DRect"] = "keyword2",
["sampler2DRectShadow"] = "keyword2",
["isampler2DRect"] = "keyword2",
["usampler2DRect"] = "keyword2",
["samplerBuffer"] = "keyword2",
["isamplerBuffer"] = "keyword2",
["usamplerBuffer"] = "keyword2",
["image1D"] = "keyword2",
["iimage1D"] = "keyword2",
["uimage1D"] = "keyword2",
["image1DArray"] = "keyword2",
["iimage1DArray"] = "keyword2",
["uimage1DArray"] = "keyword2",
["image2D"] = "keyword2",
["iimage2D"] = "keyword2",
["uimage2D"] = "keyword2",
["image2DArray"] = "keyword2",
["iimage2DArray"] = "keyword2",
["uimage2DArray"] = "keyword2",
["image2DRect"] = "keyword2",
["iimage2DRect"] = "keyword2",
["uimage2DRect"] = "keyword2",
["image2DMS"] = "keyword2",
["iimage2DMS"] = "keyword2",
["uimage2DMS"] = "keyword2",
["image2DMSArray"] = "keyword2",
["iimage2DMSArray"]= "keyword2",
["uimage2DMSArray"]= "keyword2",
["image3D"] = "keyword2",
["iimage3D"] = "keyword2",
["uimage3D"] = "keyword2",
["imageCube"] = "keyword2",
["iimageCube"] = "keyword2",
["uimageCube"] = "keyword2",
["imageCubeArray"] = "keyword2",
["iimageCubeArray"]= "keyword2",
["uimageCubeArray"]= "keyword2",
["imageBuffer"] = "keyword2",
["iimageBuffer"] = "keyword2",
["uimageBuffer"] = "keyword2",
["atomic_uint"] = "keyword2",
["radians"] = "keyword",
["degrees"] = "keyword",
["sin"] = "keyword",
["cos"] = "keyword",
["tan"] = "keyword",
["asin"] = "keyword",
["acos"] = "keyword",
["atan"] = "keyword",
["sinh"] = "keyword",
["cosh"] = "keyword",
["tanh"] = "keyword",
["asinh"] = "keyword",
["acosh"] = "keyword",
["pow"] = "keyword",
["exp"] = "keyword",
["exp2"] = "keyword",
["log2"] = "keyword",
["sqrt"] = "keyword",
["inversesqrt"] = "keyword",
["abs"] = "keyword",
["sign"] = "keyword",
["floor"] = "keyword",
["trunc"] = "keyword",
["round"] = "keyword",
["roundEven"] = "keyword",
["ceil"] = "keyword",
["fract"] = "keyword",
["mod"] = "keyword",
["modf"] = "keyword",
["min"] = "keyword",
["max"] = "keyword",
["clamp"] = "keyword",
["mix"] = "keyword",
["step"] = "keyword",
["smoothstep"] = "keyword",
["isnan"] = "keyword",
["isinf"] = "keyword",
["floatBitsToInt"] = "keyword",
["floatBitsToUint"] = "keyword",
["intBitsToFloat"] = "keyword",
["uintBitsToFloat"] = "keyword",
["fma"] = "keyword",
["frexp"] = "keyword",
["ldexp"] = "keyword",
["packUnorm2x16"] = "keyword",
["packSnorm2x16"] = "keyword",
["packUnorm4x8"] = "keyword",
["packSnorm4x8"] = "keyword",
["unpackUnorm2x16"] = "keyword",
["unpackSnorm2x16"] = "keyword",
["unpackUnorm4x8"] = "keyword",
["unpackSnorm4x8"] = "keyword",
["packHalf2x16"] = "keyword",
["unpackHalf2x16"] = "keyword",
["packDouble2x32"] = "keyword",
["unpackDouble2x32"] = "keyword",
["length"] = "keyword",
["distance"] = "keyword",
["dot"] = "keyword",
["cross"] = "keyword",
["normalize"] = "keyword",
["ftransform"] = "keyword",
["faceforward"] = "keyword",
["reflect"] = "keyword",
["refract"] = "keyword",
["matrixCompMult"] = "keyword",
["outerProduct"] = "keyword",
["transpose"] = "keyword",
["determinant"] = "keyword",
["inverse"] = "keyword",
["lessThan"] = "keyword",
["lessThanEqual"] = "keyword",
["greaterThan"] = "keyword",
["greaterThanEqual"] = "keyword",
["equal"] = "keyword",
["notEqual"] = "keyword",
["any"] = "keyword",
["all"] = "keyword",
["not"] = "keyword",
["uaddCarry"] = "keyword",
["usubBorrow"] = "keyword",
["umulExtended"] = "keyword",
["imulExtended"] = "keyword",
["bitfieldExtract"] = "keyword",
["bitfieldInsert"] = "keyword",
["bitfieldReverse"] = "keyword",
["bitCount"] = "keyword",
["findLSB"] = "keyword",
["findMSB"] = "keyword",
["textureSize"] = "keyword",
["textureQueryLod"] = "keyword",
["textureQueryLevels"] = "keyword",
["textureSamples"] = "keyword",
["texture"] = "keyword",
["textureProj"] = "keyword",
["textureLod"] = "keyword",
["textureOffset"] = "keyword",
["texelFetch"] = "keyword",
["texelFetchOffset"] = "keyword",
["textureProjOffset"] = "keyword",
["textureLodOffset"] = "keyword",
["textureProjLod"] = "keyword",
["textureProjLodOffset"] = "keyword",
["textureGrad"] = "keyword",
["textureGradOffset"] = "keyword",
["textureProjGrad"] = "keyword",
["textureProjGradOffset"]= "keyword",
["textureGather"] = "keyword",
["textureGatherOffset"] = "keyword",
["textureGatherOffsets"] = "keyword",
--Atomic Counter Functions
["atomicCounterIncrement"]= "keyword",
["atomicCounterDecrement"]= "keyword",
["atomicCounter"] = "keyword",
["atomicCounterAdd"] = "keyword",
["atomicCounterSubtract"] = "keyword",
["atomicCounterMin"] = "keyword",
["atomicCounterMax"] = "keyword",
["atomicCounterAnd"] = "keyword",
["atomicCounterOr"] = "keyword",
["atomicCounterXor"] = "keyword",
["atomicCounterExchange"] = "keyword",
["atomicCounterCompSwap"] = "keyword",
--Atomic Memory Functions
["atomicAdd"] = "keyword",
["atomicMin"] = "keyword",
["atomicMax"] = "keyword",
["atomicAnd"] = "keyword",
["atomicOr"] = "keyword",
["atomicXor"] = "keyword",
["atomicExchange"]= "keyword",
["atomicCompSwap"]= "keyword",
--Image Functions
["imageSize"] = "keyword",
["imageSamples"] = "keyword",
["imageLoad"] = "keyword",
["imageStore"] = "keyword",
["imageAtomicAdd"] = "keyword",
["imageAtomicMin"] = "keyword",
["imageAtomicMax"] = "keyword",
["imageAtomicAnd"] = "keyword",
["imageAtomicOr"] = "keyword",
["imageAtomicXor"] = "keyword",
["imageAtomicExchange"]= "keyword",
["imageAtomicCompSwap"]= "keyword",
--Geometry Shader Functions
["EmitStreamVertex"] = "keyword",
["EndStreamPrimitive"] = "keyword",
["EmitVertex"] = "keyword",
["EndPrimitive"] = "keyword",
--Fragment Processing Functions
["dFdx"] = "keyword",
["dFdy"] = "keyword",
["dFdxFine"] = "keyword",
["dFdyFine"] = "keyword",
["dFdxCoarse"] = "keyword",
["dFdyCoarse"] = "keyword",
["fwidth"] = "keyword",
["fwidthFine"] = "keyword",
["fwidthCoarse"] = "keyword",
["interpolateAtCentroid"]= "keyword",
["interpolateAtSample"] = "keyword",
["interpolateAtOffset"] = "keyword",
--Shader Invocation Control Functions
["barrier"] = "keyword",
--Shader Memory Control Functions
["memoryBarrier"] = "keyword",
["memoryBarrierAtomicCounter"]= "keyword",
["memoryBarrierBuffer"] = "keyword",
["memoryBarrierShared"] = "keyword",
["memoryBarrierImage"] = "keyword",
["groupMemoryBarrier"] = "keyword",
--Subpass-Input Functions
["subpassLoad"] = "keyword",
--Shader Invocation Group Functions
["anyInvocation"] = "keyword",
["allInvocations"] = "keyword",
["allInvocationsEqual"]= "keyword",
--"In addition, when targeting Vulkan, the following keywords also exist:"
["texture1D"] = "keyword",
["texture1DArray"] = "keyword",
["itexture1D"] = "keyword",
["itexture1DArray"] = "keyword",
["utexture1D"] = "keyword",
["utexture1DArray"] = "keyword",
["texture2D"] = "keyword",
["texture2DArray"] = "keyword",
["itexture2D"] = "keyword",
["itexture2DArray"] = "keyword",
["utexture2D"] = "keyword",
["utexture2DArray"] = "keyword",
["texture2DRect"] = "keyword",
["itexture2DRect"] = "keyword",
["utexture2DRect"] = "keyword",
["texture2DMS"] = "keyword",
["itexture2DMS"] = "keyword",
["utexture2DMS"] = "keyword",
["texture2DMSArray"] = "keyword",
["itexture2DMSArray"]= "keyword",
["utexture2DMSArray"]= "keyword",
["texture3D"] = "keyword",
["itexture3D"] = "keyword",
["utexture3D"] = "keyword",
["textureCube"] = "keyword",
["itextureCube"] = "keyword",
["utextureCube"] = "keyword",
["textureCubeArray"] = "keyword",
["itextureCubeArray"]= "keyword",
["utextureCubeArray"]= "keyword",
["textureBuffer"] = "keyword",
["itextureBuffer"] = "keyword",
["utextureBuffer"] = "keyword",
["sampler"] = "keyword2",
["samplerShadow"] = "keyword2",
["subpassInput"] = "keyword2",
["isubpassInput"] = "keyword2",
["usubpassInput"] = "keyword2",
["subpassInputMS"] = "keyword2",
["isubpassInputMS"] = "keyword2",
["usubpassInputMS"] = "keyword2",
},
}

View File

@ -0,0 +1,274 @@
local style = require "core.style"
local common = require "core.common"
local syntax = require "core.syntax"
syntax.add {
files = { "%.hlsl$", },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { "#", "[^\\]\n" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "int[1-9]x[1-9]", type = "keyword2" },
{ pattern = "int1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "int[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "int1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "int[1-4]", type = "keyword2" },
{ pattern = "uint[1-9]x[1-9]", type = "keyword2" },
{ pattern = "uint1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "uint[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "uint1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "uint[1-4]", type = "keyword2" },
{ pattern = "dword[1-9]x[1-9]", type = "keyword2" },
{ pattern = "dword1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "dword[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "dword1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "dword[1-4]", type = "keyword2" },
{ pattern = "half[1-9]x[1-9]", type = "keyword2" },
{ pattern = "half1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "half[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "half1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "half[1-4]", type = "keyword2" },
{ pattern = "float[1-9]x[1-9]", type = "keyword2" },
{ pattern = "float1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "float[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "float1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "float[1-4]", type = "keyword2" },
{ pattern = "double[1-9]x[1-9]", type = "keyword2" },
{ pattern = "double1[0-6]x[1-9]", type = "keyword2" },
{ pattern = "double[1-9]x1[0-6]", type = "keyword2" },
{ pattern = "double1[0-6]x1[0-6]", type = "keyword2" },
{ pattern = "double[1-4]", type = "keyword2" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
--https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-keywords
--The symbols are added in the order they appear on this webpage, which is alphabetically
["AppendStructuredBuffer"]= "keyword",
["asm"] = "keyword",
["asm_fragment"] = "keyword",
["BlendState"] = "keyword2",
["bool"] = "keyword2",
["break"] = "keyword",
["Buffer"] = "keyword2",
["ByteAddressBuffer"]= "keyword2",
["case"] = "keyword",
["cbuffer"] = "keyword2",
["centroid"] = "keyword2",
["class"] = "keyword",
["column_major"] = "keyword",
["compile"] = "keyword",
["compile_fragment"] = "keyword",
["CompileShader"] = "keyword",
["const"] = "keyword",
["continue"] = "keyword",
["ComputeShader"] = "keyword",
["ConsumeStructuredBuffer"]= "keyword",
["default"] = "keyword",
["DepthStencilState"]= "keyword",
["DepthStencilView"] = "keyword",
["discard"] = "keyword",
["do"] = "keyword",
["double"] = "keyword2",
["DomainShader"] = "keyword2",
["dword"] = "keyword2",
["else"] = "keyword",
["export"] = "keyword",
["extern"] = "keyword",
["false"] = "literal",
["float"] = "keyword2",
["for"] = "keyword",
["fxgroup"] = "keyword2",
["GeometryShader"] = "keyword2",
["groupshared"] = "keyword",
["half"] = "keyword2",
["HullShader"] = "keyword2",
["if"] = "keyword",
["in"] = "keyword",
["inline"] = "keyword",
["inout"] = "keyword",
["InputPatch"] = "keyword2",
["int"] = "keyword2",
["interface"] = "keyword",
["line"] = "keyword2",
["lineadj"] = "keyword2",
["linear"] = "keyword",
["LineStream"] = "keyword2",
["matrix"] = "keyword2",
["min16float"] = "keyword2",
["min10float"] = "keyword2",
["min16int"] = "keyword2",
["min12int"] = "keyword2",
["min16uint"] = "keyword2",
["namespace"] = "keyword",
["nointerpolation"] = "keyword",
["noperspective"] = "keyword",
["NULL"] = "literal",
["out"] = "keyword",
["OutputPatch"] = "keyword2",
["packoffset"] = "keyword",
["pass"] = "keyword",
["pixelfragment"] = "keyword",
["PixelShader"] = "keyword2",
["point"] = "keyword2",
["PointStream"] = "keyword2",
["precise"] = "keyword",
["RasterizerState"] = "keyword2",
["RenderTargetView"] = "keyword2",
["return"] = "keyword",
["register"] = "keyword",
["row_major"] = "keyword",
["RWBuffer"] = "keyword2",
["RWByteAddressBuffer"]= "keyword2",
["RWStructuredBuffer"]= "keyword2",
["RWTexture1D"] = "keyword2",
["RWTexture1DArray"] = "keyword2",
["RWTexture2D"] = "keyword2",
["RWTexture2DArray"] = "keyword2",
["RWTexture3D"] = "keyword2",
["sample"] = "keyword",
["sampler"] = "keyword2",
["SamplerState"] = "keyword2",
["SamplerComparisonState"]= "keyword2",
["shared"] = "keyword",
["snorm"] = "keyword",
["stateblock"] = "keyword",
["stateblock_state"] = "keyword",
["static"] = "keyword",
["string"] = "keyword2",
["struct"] = "keyword",
["switch"] = "keyword",
["StructuredBuffer"] = "keyword2",
["tbuffer"] = "keyword2",
["technique"] = "keyword2",
["technique10"] = "keyword2",
["technique11"] = "keyword2",
["texture"] = "keyword2",
["Texture1D"] = "keyword2",
["Texture1DArray"] = "keyword2",
["Texture2D"] = "keyword2",
["Texture2DArray"] = "keyword2",
["Texture2DMS"] = "keyword2",
["Texture2DMSArray"] = "keyword2",
["Texture3D"] = "keyword2",
["TextureCube"] = "keyword2",
["TextureCubeArray"] = "keyword2",
["true"] = "literal",
["typedef"] = "keyword",
["triangle"] = "keyword2",
["triangleadj"] = "keyword2",
["TriangleStream"] = "keyword2",
["uint"] = "keyword2",
["uniform"] = "keyword",
["unorm"] = "keyword",
["unsigned"] = "keyword",
["vector"] = "keyword2",
["vertexfragment"] = "keyword2",
["VertexShader"] = "keyword2",
["void"] = "keyword",
["volatile"] = "keyword",
["while"] = "keyword",
--https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-intrinsic-functions
--The symbols are added in the order they appear on this webpage, which is alphabetically
["abort"] = "keyword",
["abs"] = "keyword",
["acos"] = "keyword",
["all"] = "keyword",
["any"] = "keyword",
["asdouble"] = "keyword",
["asfloat"] = "keyword",
["asin"] = "keyword",
["asint"] = "keyword",
["asuint"] = "keyword",
["atan"] = "keyword",
["atan2"] = "keyword",
["ceil"] = "keyword",
["clamp"] = "keyword",
["clip"] = "keyword",
["cos"] = "keyword",
["cosh"] = "keyword",
["countbits"] = "keyword",
["cross"] = "keyword",
["ddx"] = "keyword",
["ddx_coarse"] = "keyword",
["ddx_fine"] = "keyword",
["ddy"] = "keyword",
["ddy_coarse"] = "keyword",
["ddy_fine"] = "keyword",
["degrees"] = "keyword",
["determinant"] = "keyword",
["distance"] = "keyword",
["dot"] = "keyword",
["dst"] = "keyword",
["errorf"] = "keyword",
["exp"] = "keyword",
["exp2"] = "keyword",
["f16tof32"] = "keyword",
["f32tof16"] = "keyword",
["faceforward"] = "keyword",
["firstbithigh"]= "keyword",
["firstbitlow"] = "keyword",
["floor"] = "keyword",
["fma"] = "keyword",
["fmod"] = "keyword",
["frac"] = "keyword",
["frexp"] = "keyword",
["fwidth"] = "keyword",
["isfinite"] = "keyword",
["isinf"] = "keyword",
["isnan"] = "keyword",
["ldexp"] = "keyword",
["length"] = "keyword",
["lerp"] = "keyword",
["lit"] = "keyword",
["log"] = "keyword",
["log10"] = "keyword",
["log2"] = "keyword",
["mad"] = "keyword",
["max"] = "keyword",
["min"] = "keyword",
["modf"] = "keyword",
["msad4"] = "keyword",
["mul"] = "keyword",
["noise"] = "keyword",
["normalize"] = "keyword",
["pow"] = "keyword",
["printf"] = "keyword",
["radians"] = "keyword",
["rcp"] = "keyword",
["reflect"] = "keyword",
["refract"] = "keyword",
["reversebits"] = "keyword",
["round"] = "keyword",
["rsqrt"] = "keyword",
["saturate"] = "keyword",
["sign"] = "keyword",
["sin"] = "keyword",
["sincos"] = "keyword",
["sinh"] = "keyword",
["smoothstep"] = "keyword",
["sqrt"] = "keyword",
["step"] = "keyword",
["tan"] = "keyword",
["tanh"] = "keyword",
["transpose"] = "keyword",
["trunc"] = "keyword",
},
}

View File

@ -0,0 +1,60 @@
local syntax = require "core.syntax"
syntax.add {
files = "%.moon$",
headers = "^#!.*[ /]moon",
comment = "--",
patterns = {
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "%[%[", "%]%]" }, type = "string" },
{ pattern = "%-%-.-\n", type = "comment" },
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "%.%.%.?", type = "keyword2" },
{ pattern = "[<>~=]=", type = "keyword2" },
{ pattern = "[%+%-=/%*%^%%#<>]", type = "keyword2" },
{ pattern = "[%a_][%w_]*%s*%f[(\"{]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = {"\\", "[%a_][%w_]*"}, type = "function" },
{ pattern = {"%.", "[%a_][%w_]*"}, type = "function" },
{ pattern = {"@", "[%a_][%w_]*"}, type = "keyword2" },
{ pattern = "!", type = "keyword2" },
{ pattern = "[%p]", type = "keyword" },
},
symbols = {
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["when"] = "keyword",
["elseif"] = "keyword",
["do"] = "keyword",
["->"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
["export"] = "keyword",
["unless"] = "keyword",
["return"] = "keyword",
["in"] = "keyword",
["not"] = "keyword",
["and"] = "keyword",
["or"] = "keyword",
["import"] = "keyword",
["as"] = "keyword",
["from"] = "keyword",
["class"] = "keyword",
["extends"] = "keyword",
["switch"] = "keyword",
["with"] = "keyword",
["using"] = "keyword",
["super"] = "keyword2",
["self"] = "keyword2",
["#"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["nil"] = "literal",
},
}

View File

@ -0,0 +1,120 @@
local syntax = require "core.syntax"
local patterns = {}
local symbols = {
["nil"] = "literal",
["true"] = "literal",
["false"] = "literal",
}
local number_patterns = {
"0[bB][01][01_]*",
"0o[0-7][0-7_]*",
"0[xX]%x[%x_]*",
"%d[%d_]*%.%d[%d_]*[eE][-+]?%d[%d_]*",
"%d[%d_]*%.%d[%d_]*",
"%d[%d_]*",
}
local type_suffix_patterns = {}
for _, size in ipairs({"", "8", "16", "32", "64"}) do
table.insert(type_suffix_patterns, "'?[fuiFUI]"..size)
end
for _, pattern in ipairs(number_patterns) do
for _, suffix in ipairs(type_suffix_patterns) do
table.insert(patterns, { pattern = pattern..suffix, type = "literal" })
end
table.insert(patterns, { pattern = pattern, type = "literal" })
end
local keywords = {
"addr", "and", "as", "asm",
"bind", "block", "break",
"case", "cast", "concept", "const", "continue", "converter",
"defer", "discard", "distinct", "div", "do",
"elif", "else", "end", "enum", "except", "export",
"finally", "for", "from", "func",
"if", "import", "in", "include", "interface", "is", "isnot", "iterator",
"let",
"macro", "method", "mixin", "mod",
"not", "notin",
"object", "of", "or", "out",
"proc", "ptr",
"raise", "ref", "return",
"shl", "shr", "static",
"template", "try", "tuple", "type",
"using",
"var",
"when", "while",
"xor",
"yield",
}
for _, keyword in ipairs(keywords) do
symbols[keyword] = "keyword"
end
local standard_types = {
"bool", "byte",
"int", "int8", "int16", "int32", "int64",
"uint", "uint8", "uint16", "uint32", "uint64",
"float", "float32", "float64",
"char", "string", "cstring",
"pointer",
"typedesc",
"void", "auto", "any",
"untyped", "typed",
"clong", "culong", "cchar", "cschar", "cshort", "cint", "csize", "csize_t",
"clonglong", "cfloat", "cdouble", "clongdouble", "cuchar", "cushort",
"cuint", "culonglong", "cstringArray",
}
for _, type in ipairs(standard_types) do
symbols[type] = "keyword2"
end
local standard_generic_types = {
"range",
"array", "open[aA]rray", "varargs", "seq", "set",
"sink", "lent", "owned",
}
for _, type in ipairs(standard_generic_types) do
table.insert(patterns, { pattern = type.."%f[%[]", type = "keyword2" })
table.insert(patterns, { pattern = type.." +%f[%w]", type = "keyword2" })
end
local user_patterns = {
-- comments
{ pattern = { "##?%[", "]##?" }, type = "comment" },
{ pattern = "##?.-\n", type = "comment" },
-- strings and chars
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { '"""', '"""[^"]' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "literal" },
-- function calls
{ pattern = "[a-zA-Z][a-zA-Z0-9_]*%f[(]", type = "function" },
-- identifiers
{ pattern = "[A-Z][a-zA-Z0-9_]*", type = "keyword2" },
{ pattern = "[a-zA-Z][a-zA-Z0-9_]*", type = "symbol" },
-- operators
{ pattern = "%.%f[^.]", type = "normal" },
{ pattern = ":%f[ ]", type = "normal" },
{ pattern = "[=+%-*/<>@$~&%%|!?%^&.:\\]+", type = "operator" },
}
for _, pattern in ipairs(user_patterns) do
table.insert(patterns, pattern)
end
local nim = {
files = { "%.nim$", "%.nims$", "%.nimble$" },
comment = "#",
patterns = patterns,
symbols = symbols,
}
syntax.add(nim)

View File

@ -0,0 +1,43 @@
local syntax = require "core.syntax"
syntax.add {
files = { "%.wren$" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "%.%.%.?", type = "operator" },
{ pattern = "[<>!=]=", type = "operator" },
{ pattern = "[%+%-=/%*%^%%<>!~|&?:]", type = "operator" },
{ pattern = "[%a_][%w_]*%s*%f[(\"{]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["break"] = "keyword",
["class"] = "keyword",
["construct"] = "keyword",
["else"] = "keyword",
["false"] = "keyword",
["for"] = "keyword",
["foreign"] = "keyword",
["if"] = "keyword",
["import"] = "keyword",
["in"] = "keyword",
["is"] = "keyword",
["null"] = "keyword",
["return"] = "keyword",
["static"] = "keyword",
["super"] = "keyword",
["this"] = "keyword",
["true"] = "keyword",
["var"] = "keyword",
["while"] = "keyword",
["this"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
},
}

View File

@ -0,0 +1,55 @@
local syntax = require "core.syntax"
syntax.add {
files = {"%.tl$","%.d.tl$"},
comment = "--",
patterns = {
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "%[%[", "%]%]" }, type = "string" },
{ pattern = { "%-%-%[%[", "%]%]"}, type = "comment" },
{ pattern = "%-%-.-\n", type = "comment" },
{ pattern = "-?0x%x+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "<%a+>", type = "keyword2" },
{ pattern = "%.%.%.?", type = "operator" },
{ pattern = "[<>~=]=", type = "operator" },
{ pattern = "[%+%-=/%*%^%%#<>]", type = "operator" },
{ pattern = "[%a_][%w_]*%s*%f[(\"{]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
{ pattern = "::[%a_][%w_]*::", type = "function" },
},
symbols = {
["if"] = "keyword",
["then"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["end"] = "keyword",
["do"] = "keyword",
["function"] = "keyword",
["repeat"] = "keyword",
["until"] = "keyword",
["while"] = "keyword",
["for"] = "keyword",
["break"] = "keyword",
["return"] = "keyword",
["local"] = "keyword",
["global"] = "keyword",
["in"] = "keyword",
["not"] = "keyword",
["and"] = "keyword",
["or"] = "keyword",
["goto"] = "keyword",
["enum"] = "keyword",
["record"] = "keyword",
["any"] = "keyword2",
["boolean"] = "keyword2",
["number"] = "keyword2",
["string"] = "keyword2",
["thread"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["nil"] = "literal",
},
}

View File

@ -0,0 +1,86 @@
local syntax = require "core.syntax"
syntax.add {
files = { "%.ts$", "%.d.ts$", "%.tsx$"},
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "`", "`", '\\' }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["any"] = "keyword2",
["arguments"] = "keyword2",
["as"] = "keyword2",
["async"] = "keyword",
["await"] = "keyword",
["boolean"] = "keyword2",
["break"] = "keyword",
["case"] = "keyword",
["catch"] = "keyword",
["class"] = "keyword",
["const"] = "keyword",
["constructor"]= "keyword2",
["continue"] = "keyword",
["debugger"] = "keyword",
["declare"] = "keyword2",
["default"] = "keyword",
["delete"] = "keyword",
["do"] = "keyword",
["else"] = "keyword",
["enum"] = "keyword2",
["export"] = "keyword",
["extends"] = "keyword",
["false"] = "literal",
["finally"] = "keyword",
["for"] = "keyword",
["from"] = "keyword",
["function"] = "keyword",
["get"] = "keyword",
["if"] = "keyword",
["implements"] = "keyword2",
["import"] = "keyword",
["in"] = "keyword",
["Infinity"] = "keyword2",
["instanceof"] = "keyword",
["interface"] = "keyword2",
["let"] = "keyword",
["module"] = "keyword2",
["new"] = "keyword",
["null"] = "literal",
["number"] = "keyword2",
["of"] = "keyword2",
["package"] = "keyword2",
["private"] = "keyword2",
["protected"] = "keyword2",
["public"] = "keyword2",
["require"] = "keyword2",
["return"] = "keyword",
["set"] = "keyword",
["static"] = "keyword",
["string"] = "keyword2",
["super"] = "keyword",
["switch"] = "keyword",
["symbol"] = "keyword2",
["this"] = "keyword2",
["throw"] = "keyword",
["true"] = "literal",
["try"] = "keyword",
["type"] = "keyword2",
["typeof"] = "keyword",
["undefined"] = "literal",
["var"] = "keyword",
["void"] = "keyword",
["while"] = "keyword",
["with"] = "keyword",
["yield"] = "keyword",
},
}

View File

@ -0,0 +1,43 @@
local syntax = require "core.syntax"
syntax.add {
files = { "%.wren$" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "%.%.%.?", type = "operator" },
{ pattern = "[<>!=]=", type = "operator" },
{ pattern = "[%+%-=/%*%^%%<>!~|&?:]", type = "operator" },
{ pattern = "[%a_][%w_]*%s*%f[(\"{]", type = "function" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
["break"] = "keyword",
["class"] = "keyword",
["construct"] = "keyword",
["else"] = "keyword",
["false"] = "keyword",
["for"] = "keyword",
["foreign"] = "keyword",
["if"] = "keyword",
["import"] = "keyword",
["in"] = "keyword",
["is"] = "keyword",
["null"] = "keyword",
["return"] = "keyword",
["static"] = "keyword",
["super"] = "keyword",
["this"] = "keyword",
["true"] = "keyword",
["var"] = "keyword",
["while"] = "keyword",
["this"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["null"] = "literal",
},
}

View File

@ -0,0 +1,53 @@
-- CloseConfirmX plugin for lite text editor
-- implementation by chekoopa
local core = require "core"
local config = require "core.config"
config.closeconfirmx_use_legacy = false
config.closeconfirmx_use_short_name = true
local legacy_confirm = core.confirm_close_all
local function commandful_confirm()
local dirty_count = 0
local dirty_name
for _, doc in ipairs(core.docs) do
if doc:is_dirty() then
dirty_count = dirty_count + 1
dirty_name = doc:get_name()
end
end
if dirty_count > 0 then
local text
if dirty_count == 1 then
if config.closeconfirmx_use_short_name then
dirty_name = dirty_name:match("[^/%\\]*$")
end
text = string.format("Unsaved changes in \"%s\"; Confirm Exit", dirty_name)
else
text = string.format("Unsaved changes in %d docs; Confirm Exit", dirty_count)
end
core.command_view:enter(text, function(_, item)
if item.text:match("^[cC]") then
core.quit(true)
end
end, function(text)
local items = {}
if not text:find("^[^sS]") then table.insert(items, "Stay here") end
if not text:find("^[^cC]") then table.insert(items, "Close Without Saving") end
return items
end)
-- as we delegate a choice inside the callback,
return false
end
return true
end
function core.confirm_close_all()
if config.closeconfirmx_use_legacy then
return legacy_confirm()
else
return commandful_confirm()
end
end

View File

@ -0,0 +1,54 @@
local common = require "core.common"
local DocView = require "core.docview"
local white = { common.color "#ffffff" }
local black = { common.color "#000000" }
local tmp = {}
local function draw_color_previews(self, idx, x, y, ptn, base, nibbles)
local text = self.doc.lines[idx]
local s, e = 0, 0
while true do
s, e = text:find(ptn, e + 1)
if not s then break end
local str = text:sub(s, e)
local r, g, b = str:match(ptn)
r, g, b = tonumber(r, base), tonumber(g, base), tonumber(b, base)
-- #123 becomes #112233
if nibbles then
r = r * 16
g = g * 16
b = b * 16
end
local x1 = x + self:get_col_x_offset(idx, s)
local x2 = x + self:get_col_x_offset(idx, e + 1)
local oy = self:get_line_text_y_offset()
local text_color = math.max(r, g, b) < 128 and white or black
tmp[1], tmp[2], tmp[3] = r, g, b
local l1, _, l2, _ = self.doc:get_selection(true)
if not (self.doc:has_selection() and idx >= l1 and idx <= l2) then
renderer.draw_rect(x1, y, x2 - x1, self:get_line_height(), tmp)
renderer.draw_text(self:get_font(), str, x1, y + oy, text_color)
end
end
end
local draw_line_text = DocView.draw_line_text
function DocView:draw_line_text(idx, x, y)
draw_line_text(self, idx, x, y)
draw_color_previews(self, idx, x, y, "#(%x%x)(%x%x)(%x%x)%f[%W]", 16)
draw_color_previews(self, idx, x, y, "#(%x)(%x)(%x)%f[%W]", 16, true) -- support #fff css format
draw_color_previews(self, idx, x, y, "rgb?%((%d+)%D+(%d+)%D+(%d+).-%)", 10)
draw_color_previews(self, idx, x, y, "rgba?%((%d+)%D+(%d+)%D+(%d+).-%)", 10)
end

View File

@ -0,0 +1,68 @@
local core = require "core"
local config = require "core.config"
local style = require "core.style"
local StatusView = require "core.statusview"
local git = {
branch = nil,
inserts = 0,
deletes = 0,
}
local function exec(cmd, wait)
local tempfile = core.temp_filename()
system.exec(string.format("%s > %q", cmd, tempfile))
coroutine.yield(wait)
local fp = io.open(tempfile)
local res = fp:read("*a")
fp:close()
os.remove(tempfile)
return res
end
core.add_thread(function()
while true do
if system.get_file_info(".git") then
-- get branch name
git.branch = exec("git rev-parse --abbrev-ref HEAD", 1):match("[^\n]*")
-- get diff
local line = exec("git diff --stat", 1):match("[^\n]*%s*$")
git.inserts = tonumber(line:match("(%d+) ins")) or 0
git.deletes = tonumber(line:match("(%d+) del")) or 0
else
git.branch = nil
end
coroutine.yield(config.project_scan_rate)
end
end)
local get_items = StatusView.get_items
function StatusView:get_items()
if not git.branch then
return get_items(self)
end
local left, right = get_items(self)
local t = {
style.dim, self.separator,
(git.inserts ~= 0 or git.deletes ~= 0) and style.accent or style.text,
git.branch,
style.dim, " ",
git.inserts ~= 0 and style.accent or style.text, "+", git.inserts,
style.dim, " / ",
git.deletes ~= 0 and style.accent or style.text, "-", git.deletes,
}
for _, item in ipairs(t) do
table.insert(right, item)
end
return left, right
end

View File

@ -0,0 +1,64 @@
local core = require "core"
local command = require "core.command"
local config = require "core.config"
local keymap = require "core.keymap"
config.lfautoinsert_map = {
["{%s*\n"] = "}",
["%(%s*\n"] = ")",
["%f[[]%[%s*\n"] = "]",
["%[%[%s*\n"] = "]]",
["=%s*\n"] = false,
[":%s*\n"] = false,
["^#if.*\n"] = "#endif",
["^#else.*\n"] = "#endif",
["%f[%w]do%s*\n"] = "end",
["%f[%w]then%s*\n"] = "end",
["%f[%w]else%s*\n"] = "end",
["%f[%w]repeat%s*\n"] = "until",
["%f[%w]function.*%)%s*\n"] = "end",
["^%s*<([^/][^%s>]*)[^>]*>%s*\n"] = "</$TEXT>",
}
local function indent_size(doc, line)
local text = doc.lines[line] or ""
local s, e = text:find("^[\t ]*")
return e - s
end
command.add("core.docview", {
["autoinsert:newline"] = function()
command.perform("doc:newline")
local doc = core.active_view.doc
local line, col = doc:get_selection()
local text = doc.lines[line - 1]
for ptn, close in pairs(config.lfautoinsert_map) do
local s, _, str = text:find(ptn)
if s then
if close
and col == #doc.lines[line]
and indent_size(doc, line + 1) <= indent_size(doc, line - 1)
then
close = str and close:gsub("$TEXT", str) or close
command.perform("doc:newline")
core.active_view:on_text_input(close)
command.perform("doc:move-to-previous-line")
if doc.lines[line+1] == doc.lines[line+2] then
doc:remove(line+1, 1, line+2, 1)
end
elseif col < #doc.lines[line] then
command.perform("doc:newline")
command.perform("doc:move-to-previous-line")
end
command.perform("doc:indent")
end
end
end
})
keymap.add {
["return"] = { "command:submit", "autoinsert:newline" }
}

View File

@ -0,0 +1,30 @@
local core = require "core"
local command = require "core.command"
local config = require "core.config"
if PLATFORM == "Windows" then
config.filemanager = "explorer"
elseif PLATFORM == "Mac OS X" then
config.filemanager = "open"
else
config.filemanager = "xdg-open"
end
command.add("core.docview", {
["open-file-location:open-file-location"] = function()
local doc = core.active_view.doc
if not doc.filename then
core.error "Cannot open location of unsaved doc"
return
end
local folder = doc.filename:match("^(.*)[/\\].*$") or "."
core.log("Opening \"%s\"", folder)
if PLATFORM == "Windows" then
system.exec(string.format("%s %s", config.filemanager, folder))
else
system.exec(string.format("%s %q", config.filemanager, folder))
end
end
})

View File

@ -0,0 +1,58 @@
local tokenizer = require "core.tokenizer"
local style = require "core.style"
local common = require "core.common"
local tokenize = tokenizer.tokenize
local closers = {
["("] = ")",
["["] = "]",
["{"] = "}"
}
local function parenstyle(parenstack)
return "paren" .. ((#parenstack % 5) + 1)
end
function tokenizer.tokenize(syntax, text, state)
state = state or {}
local res, istate = tokenize(syntax, text, state.istate)
local parenstack = state.parenstack or ""
local newres = {}
-- split parens out
-- the stock tokenizer can't do this because it merges identical adjacent tokens
for i, type, text in tokenizer.each_token(res) do
if type == "normal" or type == "symbol" then
for normtext1, paren, normtext2 in text:gmatch("([^%(%[{}%]%)]*)([%(%[{}%]%)]?)([^%(%[{}%]%)]*)") do
if #normtext1 > 0 then
table.insert(newres, type)
table.insert(newres, normtext1)
end
if #paren > 0 then
if paren == parenstack:sub(-1) then -- expected closer
parenstack = parenstack:sub(1, -2)
table.insert(newres, parenstyle(parenstack))
elseif closers[paren] then -- opener
table.insert(newres, parenstyle(parenstack))
parenstack = parenstack .. closers[paren]
else -- unexpected closer
table.insert(newres, "paren_unbalanced")
end
table.insert(newres, paren)
end
if #normtext2 > 0 then
table.insert(newres, type)
table.insert(newres, normtext2)
end
end
else
table.insert(newres, type)
table.insert(newres, text)
end
end
return newres, { parenstack = parenstack, istate = istate }
end
style.syntax.paren_unbalanced = style.syntax.paren_unbalanced or { common.color "#DC0408" }
style.syntax.paren1 = style.syntax.paren1 or { common.color "#FC6F71"}
style.syntax.paren2 = style.syntax.paren2 or { common.color "#fcb053"}
style.syntax.paren3 = style.syntax.paren3 or { common.color "#fcd476"}
style.syntax.paren4 = style.syntax.paren4 or { common.color "#52dab2"}
style.syntax.paren5 = style.syntax.paren5 or { common.color "#5a98cf"}

View File

@ -0,0 +1,40 @@
--[[
scalestatus.lua
displays current scale (zoom) in status view
version: 20200628_155804
originally by SwissalpS
Depends on plugin scale.lua version >= 20200628_154010
--]]
local scale = require "plugins.scale"
-- make sure plugin is installed and has get_scale field
if not scale.get_scale then
local core = require "core"
core.error("Plugin 'scale' needs to be updated, scalestatus inactive.")
return false
end
local config = require "core.config"
local StatusView = require "core.statusview"
config.scalestatus_format = '%.0f%%'
local get_items = StatusView.get_items
function StatusView:get_items()
local left, right = get_items(self)
local t = {
self.separator,
string.format(config.scalestatus_format, scale.get_scale() * 100),
}
for _, item in ipairs(t) do
table.insert(right, item)
end
return left, right
end
return true

View File

@ -1,58 +1,20 @@
-- mod-version:3
local core = require "core"
local common = require "core.common"
local DocView = require "core.docview"
local LogView = require "core.logview"
local workspace_filename = ".lite_workspace.lua"
local function workspace_files_for(project_dir)
local basename = common.basename(project_dir)
local workspace_dir = USERDIR .. PATHSEP .. "ws"
local info_wsdir = system.get_file_info(workspace_dir)
if not info_wsdir then
local ok, err = system.mkdir(workspace_dir)
if not ok then
error("cannot create workspace directory: \"" .. err .. "\"")
local function serialize(val)
if type(val) == "string" then
return string.format("%q", val)
elseif type(val) == "table" then
local t = {}
for k, v in pairs(val) do
table.insert(t, "[" .. serialize(k) .. "]=" .. serialize(v))
end
return "{" .. table.concat(t, ",") .. "}"
end
return coroutine.wrap(function()
local files = system.list_dir(workspace_dir) or {}
local n = #basename
for _, file in ipairs(files) do
if file:sub(1, n) == basename then
local id = tonumber(file:sub(n + 1):match("^-(%d+)$"))
if id then
coroutine.yield(workspace_dir .. PATHSEP .. file, id)
end
end
end
end)
end
local function consume_workspace_file(project_dir)
for filename, id in workspace_files_for(project_dir) do
local load_f = loadfile(filename)
local workspace = load_f and load_f()
if workspace and workspace.path == project_dir then
os.remove(filename)
return workspace
end
end
end
local function get_workspace_filename(project_dir)
local id_list = {}
for filename, id in workspace_files_for(project_dir) do
id_list[id] = true
end
local id = 1
while id_list[id] do
id = id + 1
end
local basename = common.basename(project_dir)
return USERDIR .. PATHSEP .. "ws" .. PATHSEP .. basename .. "-" .. tostring(id)
return tostring(val)
end
@ -83,18 +45,15 @@ local function save_view(view)
filename = view.doc.filename,
selection = { view.doc:get_selection() },
scroll = { x = view.scroll.to.x, y = view.scroll.to.y },
crlf = view.doc.crlf,
text = view.doc.new_file and view.doc:get_text(1, 1, math.huge, math.huge)
text = not view.doc.filename and view.doc:get_text(1, 1, math.huge, math.huge)
}
end
if mt == LogView then return end
for name, mod in pairs(package.loaded) do
if mod == mt then
return {
type = "view",
active = (core.active_view == view),
module = name,
scroll = { x = view.scroll.to.x, y = view.scroll.to.y, to = { x = view.scroll.to.x, y = view.scroll.to.y } },
module = name
}
end
end
@ -103,27 +62,16 @@ end
local function load_view(t)
if t.type == "doc" then
local dv
if not t.filename then
-- document not associated to a file
dv = DocView(core.open_doc())
else
-- we have a filename, try to read the file
local ok, doc = pcall(core.open_doc, t.filename)
if ok then
dv = DocView(doc)
if not ok then
return DocView(core.open_doc())
end
end
if dv and dv.doc then
if dv.doc.new_file and t.text then
dv.doc:insert(1, 1, t.text)
dv.doc.crlf = t.crlf
end
dv.doc:set_selection(table.unpack(t.selection))
dv.last_line1, dv.last_col1, dv.last_line2, dv.last_col2 = dv.doc:get_selection()
local dv = DocView(doc)
if t.text then doc:insert(1, 1, t.text) end
doc:set_selection(table.unpack(t.selection))
dv.last_line, dv.last_col = doc:get_selection()
dv.scroll.x, dv.scroll.to.x = t.scroll.x, t.scroll.x
dv.scroll.y, dv.scroll.to.y = t.scroll.y, t.scroll.y
end
return dv
end
return require(t.module)()
@ -156,22 +104,13 @@ end
local function load_node(node, t)
if t.type == "leaf" then
local res
local active_view
for i, v in ipairs(t.views) do
for _, v in ipairs(t.views) do
local view = load_view(v)
if view then
if v.active then res = view end
node:add_view(view)
if t.active_view == i then
active_view = view
end
if not view:is(DocView) then
view.scroll = v.scroll
end
end
end
if active_view then
node:set_active_view(active_view)
if t.active_view then
node:set_active_view(node.views[t.active_view])
end
return res
else
@ -184,63 +123,57 @@ local function load_node(node, t)
end
local function save_directories()
local project_dir = core.project_dir
local dir_list = {}
for i = 2, #core.project_directories do
dir_list[#dir_list + 1] = common.relative_path(project_dir, core.project_directories[i].name)
end
return dir_list
end
local function save_workspace()
local root = get_unlocked_root(core.root_view.root_node)
local workspace_filename = get_workspace_filename(core.project_dir)
local fp = io.open(workspace_filename, "w")
if fp then
local node_text = common.serialize(save_node(root))
local dir_text = common.serialize(save_directories())
fp:write(string.format("return { path = %q, documents = %s, directories = %s }\n", core.project_dir, node_text, dir_text))
fp:write("return ", serialize(save_node(root)), "\n")
fp:close()
end
end
local function load_workspace()
local workspace = consume_workspace_file(core.project_dir)
if workspace then
local ok, t = pcall(dofile, workspace_filename)
os.remove(workspace_filename)
if ok then
local root = get_unlocked_root(core.root_view.root_node)
local active_view = load_node(root, workspace.documents)
local active_view = load_node(root, t)
if active_view then
core.set_active_view(active_view)
end
for i, dir_name in ipairs(workspace.directories) do
core.add_project_directory(system.absolute_path(dir_name))
end
end
end
local run = core.run
function core.run(...)
if #core.docs == 0 then
core.try(load_workspace)
local on_quit_project = core.on_quit_project
function core.on_quit_project()
core.try(save_workspace)
on_quit_project()
end
local on_enter_project = core.on_enter_project
function core.on_enter_project(new_dir)
on_enter_project(new_dir)
core.try(load_workspace)
local exit = os.exit
function os.exit(...)
save_workspace()
exit(...)
end
end
core.run = run
return core.run(...)
end
local run1 = core.run1
function core.run1(...)
if #core.docs == 0 then
core.try(load_workspace)
local exit = os.exit
function os.exit(...)
save_workspace()
exit(...)
end
end
core.run1 = run1
return core.run1(...)
end

View File

@ -2,7 +2,7 @@ local style = require "core.style"
local common = require "core.common"
style.background = { common.color "#242424" } -- main background
style.background2 = { common.color "#202020" } -- sidebar backgrounds
style.background2 = { common.color "#1a1a1a" } -- sidebar background and inactive tabs
style.background3 = { common.color "#202020" } -- bottombar background prompts
style.text = { common.color "#9ea191" }
style.caret = { common.color "#F8F8F0" }

View File

@ -395,7 +395,7 @@ void game(unsigned frame, float dt, double t) {
int main(){
window_title("Editor " EDITOR_VERSION);
window_create(flag("--transparent") ? 101 : 80,0);
window_icon("logo.png");
window_icon("scale-ruler-icon.png");
while( window_swap() ) {
editor_frame(game);

View File

@ -576,7 +576,7 @@ void editor_frame( void (*game)(unsigned, float, double) ) {
game(editor.frame, editor.dt, editor.t);
// timing
editor.dt = window_delta() /*clampf(window_delta(), 0, 1/60.f)*/ * !window_has_pause() * editor.slomo;
editor.dt = clampf(window_delta(), 0, 1/60.f) * !window_has_pause() * editor.slomo;
editor.t += editor.dt;
editor.frame += !window_has_pause();
editor.frame += !editor.frame;

View File

@ -7,6 +7,15 @@
#include "3rd_lite.h"
// }
TODO("bug: lite key bindings are being sent to editor")
TODO("eval: https://github.com/Jipok/lite-plugins")
TODO("eval: https://github.com/drmargarido/linters")
TODO("eval: https://github.com/monolifed/theme16")
TODO("eval: https://github.com/takase1121/lite-contextmenu ")
TODO("eval: https://github.com/drmargarido/TodoTreeView")
TODO("eval: https://github.com/takase1121/lite-nagbar")
TODO("eval: https://github.com/rxi/console")
int ui_texture_fit(texture_t t, struct nk_rect bounds) {
// allocate complete window space
struct nk_rect total_space = nk_window_get_content_region(ui_ctx);