Merge branch 'master' of github.com:lite-xl/lite-xl into better-logview

This commit is contained in:
takase1121 2021-12-21 17:37:19 +08:00
commit 3e175f5ad5
No known key found for this signature in database
GPG Key ID: 60EEFFC68EB3031B
14 changed files with 71 additions and 59 deletions

View File

@ -18,9 +18,9 @@ Lite XL has support for high DPI display on Windows and Linux and,
since 1.16.7 release, it supports **retina displays** on macOS. since 1.16.7 release, it supports **retina displays** on macOS.
Please note that Lite XL is compatible with lite for most plugins and all color themes. Please note that Lite XL is compatible with lite for most plugins and all color themes.
We provide a separate lite-plugins repository for Lite XL, because in some cases We provide a separate lite-xl-plugins repository for Lite XL, because in some cases
some adaptations may be needed to make them work better with Lite XL. some adaptations may be needed to make them work better with Lite XL.
The repository with modified plugins is https://github.com/franko/lite-plugins. The repository with modified plugins is https://github.com/lite-xl/lite-xl-plugins.
The changes and differences between Lite XL and rxi/lite are listed in the The changes and differences between Lite XL and rxi/lite are listed in the
[changelog]. [changelog].
@ -131,10 +131,7 @@ rm -rf $HOME/.local/share/icons/hicolor/scalable/apps/lite-xl.svg \
## Contributing ## Contributing
Any additional functionality that can be added through a plugin should be done Any additional functionality that can be added through a plugin should be done
as a plugin, after which a pull request to the [plugins repository] can be made. as a plugin, after which a pull request to the [Lite XL plugins repository] can be made.
If the plugin uses any Lite XL-specific functionality,
please open a pull request to the [Lite XL plugins repository].
Pull requests to improve or modify the editor itself are welcome. Pull requests to improve or modify the editor itself are welcome.
@ -150,14 +147,13 @@ See the [licenses] file for details on licenses used by the required dependencie
[Discord Badge Image]: https://img.shields.io/discord/847122429742809208?label=discord&logo=discord [Discord Badge Image]: https://img.shields.io/discord/847122429742809208?label=discord&logo=discord
[screenshot-dark]: https://user-images.githubusercontent.com/433545/111063905-66943980-84b1-11eb-9040-3876f1133b20.png [screenshot-dark]: https://user-images.githubusercontent.com/433545/111063905-66943980-84b1-11eb-9040-3876f1133b20.png
[lite]: https://github.com/rxi/lite [lite]: https://github.com/rxi/lite
[website]: https://lite-xl.github.io [website]: https://lite-xl.com
[build]: https://lite-xl.github.io/en/documentation/build/ [build]: https://lite-xl.com/en/documentation/build/
[Get Lite XL]: https://github.com/franko/lite-xl/releases/latest [Get Lite XL]: https://github.com/lite-xl/lite-xl/releases/latest
[Get plugins]: https://github.com/franko/lite-plugins [Get plugins]: https://github.com/lite-xl/lite-xl-plugins
[Get color themes]: https://github.com/rxi/lite-colors [Get color themes]: https://github.com/lite-xl/lite-xl-colors
[changelog]: https://github.com/franko/lite-xl/blob/master/changelog.md [changelog]: https://github.com/lite-xl/lite-xl/blob/master/changelog.md
[Lite XL plugins repository]: https://github.com/franko/lite-plugins [Lite XL plugins repository]: https://github.com/lite-xl/lite-xl-plugins
[plugins repository]: https://github.com/rxi/lite-plugins [colors repository]: https://github.com/lite-xl/lite-xl-colors
[colors repository]: https://github.com/rxi/lite-colors
[LICENSE]: LICENSE [LICENSE]: LICENSE
[licenses]: licenses/licenses.md [licenses]: licenses/licenses.md

View File

@ -47,22 +47,22 @@ end
function common.color(str) function common.color(str)
local r, g, b, a = str:match("#(%x%x)(%x%x)(%x%x)") local r, g, b, a = str:match("^#(%x%x)(%x%x)(%x%x)(%x?%x?)$")
if r then if r then
r = tonumber(r, 16) r = tonumber(r, 16)
g = tonumber(g, 16) g = tonumber(g, 16)
b = tonumber(b, 16) b = tonumber(b, 16)
a = 1 a = tonumber(a, 16) or 0xff
elseif str:match("rgba?%s*%([%d%s%.,]+%)") then elseif str:match("rgba?%s*%([%d%s%.,]+%)") then
local f = str:gmatch("[%d.]+") local f = str:gmatch("[%d.]+")
r = (f() or 0) r = (f() or 0)
g = (f() or 0) g = (f() or 0)
b = (f() or 0) b = (f() or 0)
a = f() or 1 a = (f() or 1) * 0xff
else else
error(string.format("bad color string '%s'", str)) error(string.format("bad color string '%s'", str))
end end
return r, g, b, a * 0xff return r, g, b, a
end end

View File

@ -183,7 +183,7 @@ local function show_max_files_warning(dir)
"Filesystem is too slow: project files will not be indexed." or "Filesystem is too slow: project files will not be indexed." or
"Too many files in project directory: stopped reading at ".. "Too many files in project directory: stopped reading at "..
config.max_project_files.." files. For more information see ".. config.max_project_files.." files. For more information see "..
"usage.md at github.com/franko/lite-xl." "usage.md at github.com/lite-xl/lite-xl."
core.status_view:show_message("!", style.accent, message) core.status_view:show_message("!", style.accent, message)
end end
@ -737,7 +737,7 @@ function core.init()
"Refused Plugins", "Refused Plugins",
string.format( string.format(
"Some plugins are not loaded due to version mismatch.\n\n%s.\n\n" .. "Some plugins are not loaded due to version mismatch.\n\n%s.\n\n" ..
"Please download a recent version from https://github.com/franko/lite-plugins.", "Please download a recent version from https://github.com/lite-xl/lite-xl-plugins.",
table.concat(msg, ".\n\n")), table.concat(msg, ".\n\n")),
opt, function(item) opt, function(item)
if item.text == "Exit" then os.exit(1) end if item.text == "Exit" then os.exit(1) end

View File

@ -6,6 +6,7 @@ local function keymap_macos(keymap)
["cmd+n"] = "core:new-doc", ["cmd+n"] = "core:new-doc",
["cmd+shift+c"] = "core:change-project-folder", ["cmd+shift+c"] = "core:change-project-folder",
["cmd+shift+o"] = "core:open-project-folder", ["cmd+shift+o"] = "core:open-project-folder",
["cmd+shift+r"] = "core:restart",
["cmd+ctrl+return"] = "core:toggle-fullscreen", ["cmd+ctrl+return"] = "core:toggle-fullscreen",
["cmd+ctrl+shift+j"] = "root:split-left", ["cmd+ctrl+shift+j"] = "root:split-left",

View File

@ -146,6 +146,7 @@ keymap.add_direct {
["ctrl+n"] = "core:new-doc", ["ctrl+n"] = "core:new-doc",
["ctrl+shift+c"] = "core:change-project-folder", ["ctrl+shift+c"] = "core:change-project-folder",
["ctrl+shift+o"] = "core:open-project-folder", ["ctrl+shift+o"] = "core:open-project-folder",
["ctrl+shift+r"] = "core:restart",
["alt+return"] = "core:toggle-fullscreen", ["alt+return"] = "core:toggle-fullscreen",
["f11"] = "core:toggle-fullscreen", ["f11"] = "core:toggle-fullscreen",

View File

@ -27,36 +27,42 @@ style.icon_font = renderer.font.load(DATADIR .. "/fonts/icons.ttf", 16 * SCALE,
style.icon_big_font = style.icon_font:copy(23 * SCALE) style.icon_big_font = style.icon_font:copy(23 * SCALE)
style.code_font = renderer.font.load(DATADIR .. "/fonts/JetBrainsMono-Regular.ttf", 15 * SCALE) style.code_font = renderer.font.load(DATADIR .. "/fonts/JetBrainsMono-Regular.ttf", 15 * SCALE)
style.background = { common.color "#2e2e32" } style.background = { common.color "#2e2e32" } -- Docview
style.background2 = { common.color "#252529" } style.background2 = { common.color "#252529" } -- Treeview
style.background3 = { common.color "#252529" } style.background3 = { common.color "#252529" } -- Command view
style.text = { common.color "#97979c" } style.text = { common.color "#97979c" }
style.caret = { common.color "#93DDFA" } style.caret = { common.color "#93DDFA" }
style.accent = { common.color "#e1e1e6" } style.accent = { common.color "#e1e1e6" }
-- style.dim - text color for nonactive tabs, tabs divider, prefix in log and
-- search result, hotkeys for context menu and command view
style.dim = { common.color "#525257" } style.dim = { common.color "#525257" }
style.divider = { common.color "#202024" } style.divider = { common.color "#202024" } -- Line between nodes
style.selection = { common.color "#48484f" } style.selection = { common.color "#48484f" }
style.line_number = { common.color "#525259" } style.line_number = { common.color "#525259" }
style.line_number2 = { common.color "#83838f" } style.line_number2 = { common.color "#83838f" } -- With cursor
style.line_highlight = { common.color "#343438" } style.line_highlight = { common.color "#343438" }
style.scrollbar = { common.color "#414146" } style.scrollbar = { common.color "#414146" }
style.scrollbar2 = { common.color "#4b4b52" } style.scrollbar2 = { common.color "#4b4b52" } -- Hovered
style.nagbar = { common.color "#FF0000" } style.nagbar = { common.color "#FF0000" }
style.nagbar_text = { common.color "#FFFFFF" } style.nagbar_text = { common.color "#FFFFFF" }
style.nagbar_dim = { common.color "rgba(0, 0, 0, 0.45)" } style.nagbar_dim = { common.color "rgba(0, 0, 0, 0.45)" }
style.drag_overlay = { common.color "rgba(255,255,255,0.1)" } style.drag_overlay = { common.color "rgba(255,255,255,0.1)" }
style.drag_overlay_tab = { common.color "#93DDFA" } style.drag_overlay_tab = { common.color "#93DDFA" }
style.good = { common.color "#72b886" }
style.warn = { common.color "#FFA94D" }
style.error = { common.color "#FF3333" }
style.modified = { common.color "#1c7c9c" }
style.syntax = {} style.syntax = {}
style.syntax["normal"] = { common.color "#e1e1e6" } style.syntax["normal"] = { common.color "#e1e1e6" }
style.syntax["symbol"] = { common.color "#e1e1e6" } style.syntax["symbol"] = { common.color "#e1e1e6" }
style.syntax["comment"] = { common.color "#676b6f" } style.syntax["comment"] = { common.color "#676b6f" }
style.syntax["keyword"] = { common.color "#E58AC9" } style.syntax["keyword"] = { common.color "#E58AC9" } -- local function end if case
style.syntax["keyword2"] = { common.color "#F77483" } style.syntax["keyword2"] = { common.color "#F77483" } -- self int float
style.syntax["number"] = { common.color "#FFA94D" } style.syntax["number"] = { common.color "#FFA94D" }
style.syntax["literal"] = { common.color "#FFA94D" } style.syntax["literal"] = { common.color "#FFA94D" } -- true false nil
style.syntax["string"] = { common.color "#f7c95c" } style.syntax["string"] = { common.color "#f7c95c" }
style.syntax["operator"] = { common.color "#93DDFA" } style.syntax["operator"] = { common.color "#93DDFA" } -- = + - / < >
style.syntax["function"] = { common.color "#93DDFA" } style.syntax["function"] = { common.color "#93DDFA" }
-- This can be used to override fonts per syntax group. -- This can be used to override fonts per syntax group.

View File

@ -57,23 +57,26 @@ process.WAIT_INFINITE = -1
---@type integer ---@type integer
process.WAIT_DEADLINE = -2 process.WAIT_DEADLINE = -2
---Used for the process.options stdin, stdout and stderr fields. ---Default behavior for redirecting streams.
---This flag is deprecated and for backwards compatibility with reproc only.
---The behavior of this flag may change in future versions of Lite XL.
---@type integer ---@type integer
process.REDIRECT_DEFAULT = 0 process.REDIRECT_DEFAULT = 0
---Used for the process.options stdin, stdout and stderr fields. ---Allow Process API to read this stream via process:read functions.
---@type integer ---@type integer
process.REDIRECT_PIPE = 1 process.REDIRECT_PIPE = 1
---Used for the process.options stdin, stdout and stderr fields. ---Redirect this stream to the parent.
---@type integer ---@type integer
process.REDIRECT_PARENT = 2 process.REDIRECT_PARENT = 2
---Used for the process.options stdin, stdout and stderr fields. ---Discard this stream (piping it to /dev/null)
---@type integer ---@type integer
process.REDIRECT_DISCARD = 3 process.REDIRECT_DISCARD = 3
---Used for the process.options stdin, stdout and stderr fields. ---Redirect this stream to stdout.
---This flag can only be used on process.options.stderr.
---@type integer ---@type integer
process.REDIRECT_STDOUT = 4 process.REDIRECT_STDOUT = 4

View File

@ -20,7 +20,7 @@ show_help() {
echo "-h --help Show this help and exit." echo "-h --help Show this help and exit."
echo "-p --prefix PREFIX Install directory prefix. Default: '/'." echo "-p --prefix PREFIX Install directory prefix. Default: '/'."
echo "-v --version VERSION Sets the version on the package name." echo "-v --version VERSION Sets the version on the package name."
echo " --addons Install 3rd party addons (currently RXI colors)." echo " --addons Install 3rd party addons (currently Lite XL colors)."
echo " --debug Debug this script." echo " --debug Debug this script."
echo "-A --appimage Create an AppImage (Linux only)." echo "-A --appimage Create an AppImage (Linux only)."
echo "-B --binary Create a normal / portable package or macOS bundle," echo "-B --binary Create a normal / portable package or macOS bundle,"
@ -45,13 +45,13 @@ install_addons() {
# Copy third party color themes # Copy third party color themes
curl --insecure \ curl --insecure \
-L "https://github.com/rxi/lite-colors/archive/master.zip" \ -L "https://github.com/lite-xl/lite-xl-colors/archive/master.zip" \
-o "${build_dir}/rxi-lite-colors.zip" -o "${build_dir}/lite-xl-colors.zip"
mkdir -p "${build_dir}/third/data/colors" mkdir -p "${build_dir}/third/data/colors"
unzip "${build_dir}/rxi-lite-colors.zip" -d "${build_dir}" unzip "${build_dir}/lite-xl-colors.zip" -d "${build_dir}"
mv "${build_dir}/lite-colors-master/colors" "${build_dir}/third/data" mv "${build_dir}/lite-xl-colors-master/colors" "${build_dir}/third/data"
rm -rf "${build_dir}/lite-colors-master" rm -rf "${build_dir}/lite-xl-colors-master"
for module_name in colors; do for module_name in colors; do
cp -r "${build_dir}/third/data/$module_name" "${data_dir}" cp -r "${build_dir}/third/data/$module_name" "${data_dir}"

View File

@ -15,12 +15,12 @@ copy_directory_from_repo () {
lite_copy_third_party_modules () { lite_copy_third_party_modules () {
local build="$1" local build="$1"
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 curl --retry 5 --retry-delay 3 --insecure -L "https://github.com/lite-xl/lite-xl-colors/archive/master.zip" -o "$build/lite-xl-colors.zip" || exit 1
mkdir -p "$build/third/data/colors" "$build/third/data/plugins" mkdir -p "$build/third/data/colors" "$build/third/data/plugins"
unzip -qq "$build/rxi-lite-colors.zip" -d "$build" unzip -qq "$build/lite-xl-colors.zip" -d "$build"
mv "$build/lite-colors-master/colors" "$build/third/data" mv "$build/lite-xl-colors-master/colors" "$build/third/data"
rm -fr "$build/lite-colors-master" rm -fr "$build/lite-xl-colors-master"
rm "$build/rxi-lite-colors.zip" rm "$build/lite-xl-colors.zip"
} }
lite_branch=master lite_branch=master
@ -47,7 +47,7 @@ workdir=".repackage"
rm -fr "$workdir" && mkdir "$workdir" && pushd "$workdir" rm -fr "$workdir" && mkdir "$workdir" && pushd "$workdir"
fetch_packages_from_github () { fetch_packages_from_github () {
assets=($($wget -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/lite-xl/lite-xl/releases/latest | grep "browser_download_url" | cut -d '"' -f 4))
for url in "${assets[@]}"; do for url in "${assets[@]}"; do
echo "getting: $url" echo "getting: $url"

View File

@ -1,6 +1,6 @@
#include "api.h" #include "api.h"
#include "renderer.h" #include "../renderer.h"
#include "rencache.h" #include "../rencache.h"
static int f_font_load(lua_State *L) { static int f_font_load(lua_State *L) {
const char *filename = luaL_checkstring(L, 1); const char *filename = luaL_checkstring(L, 1);

View File

@ -6,8 +6,8 @@
#include <errno.h> #include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "api.h" #include "api.h"
#include "dirmonitor.h" #include "../dirmonitor.h"
#include "rencache.h" #include "../rencache.h"
#ifdef _WIN32 #ifdef _WIN32
#include <direct.h> #include <direct.h>
#include <windows.h> #include <windows.h>
@ -106,7 +106,15 @@ static const char *get_key_name(const SDL_Event *e, char *buf) {
!(e->key.keysym.mod & KMOD_NUM)) { !(e->key.keysym.mod & KMOD_NUM)) {
return numpad[scancode - SDL_SCANCODE_KP_1]; return numpad[scancode - SDL_SCANCODE_KP_1];
} else { } else {
strcpy(buf, SDL_GetScancodeName(e->key.keysym.scancode)); /* We need to correctly handle non-standard layouts such as dvorak.
Therefore, if a Latin letter(code<128) is pressed in the current layout,
then we transmit it as it is. But we also need to support shortcuts in
other languages, so for non-Latin characters we pass the scancode that
matches the letter in the QWERTY layout. */
if (e->key.keysym.sym < 128)
strcpy(buf, SDL_GetKeyName(e->key.keysym.sym));
else
strcpy(buf, SDL_GetScancodeName(scancode));
str_tolower(buf); str_tolower(buf);
return buf; return buf;
} }

View File

@ -1,5 +1,5 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include "lua.h" #include <lua.h>
#ifdef MACOS_USE_BUNDLE #ifdef MACOS_USE_BUNDLE
void set_macos_bundle_resources(lua_State *L) void set_macos_bundle_resources(lua_State *L)

View File

@ -1,6 +1,7 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdbool.h>
#include <stdalign.h> #include <stdalign.h>
#include <lauxlib.h> #include <lauxlib.h>

View File

@ -1,4 +0,0 @@
[wrap-git]
directory = reproc
url = https://github.com/franko/reproc
revision = v14.2.3-meson-1