Merge branch 'master' into 'dev'
This commit is contained in:
commit
1c6325b40f
|
@ -50,16 +50,16 @@ lite_build_pgo () {
|
|||
}
|
||||
|
||||
lite_build_package_windows () {
|
||||
local portable=""
|
||||
local portable="-msys"
|
||||
if [ "$1" == "-portable" ]; then
|
||||
portable="-portable"
|
||||
portable=""
|
||||
shift
|
||||
fi
|
||||
local build="$1"
|
||||
local arch="$2"
|
||||
local os="win"
|
||||
local pdir=".package-build/lite-xl"
|
||||
if [ "$portable" == "-portable" ]; then
|
||||
if [ -z "$portable" ]; then
|
||||
local bindir="$pdir"
|
||||
local datadir="$pdir/data"
|
||||
else
|
||||
|
|
28
changelog.md
28
changelog.md
|
@ -2,7 +2,7 @@ Lite XL is following closely [rxi/lite](https://github.com/rxi/lite) but with so
|
|||
|
||||
This files document the changes done in Lite XL for each release.
|
||||
|
||||
### 1.16.9
|
||||
### next release
|
||||
|
||||
[#126](https://github.com/franko/lite-xl/issues/126): Implemented changing fonts per syntax group.
|
||||
Example user module snippet that makes all comments italic:
|
||||
|
@ -14,8 +14,34 @@ local style = require "core.style"
|
|||
local italic = renderer.font.load("italic.ttf", 14)
|
||||
style.syntax_fonts["comment"] = italic
|
||||
```
|
||||
### 1.16.9
|
||||
|
||||
Fix a bug related to nested panes resizing.
|
||||
|
||||
Fix problem preventing creating a new file.
|
||||
|
||||
### 1.16.8
|
||||
|
||||
Fix application crash when using the command `core:restart`.
|
||||
|
||||
Improve application startup to reduce "flashing".
|
||||
|
||||
Move to new plugins versioning using tag `mod-version:1`.
|
||||
The mod-version is a single digit version that tracks the
|
||||
plugins compatibility version independently from the lite-xl
|
||||
version.
|
||||
|
||||
For backward compatibility the tag `-- lite-xl 1.16` is considered equivalent to
|
||||
`mod-version:1` so users don't need to update their plugins.
|
||||
|
||||
Both kind of tags can appear in new plugins in the form:
|
||||
|
||||
```lua
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
```
|
||||
|
||||
where the old tag needs to appear at the end for compatibility.
|
||||
|
||||
### 1.16.7
|
||||
|
||||
Add support for retina displays on Mac OS X.
|
||||
|
|
|
@ -229,7 +229,7 @@ end
|
|||
|
||||
|
||||
function common.normalize_path(filename)
|
||||
if PATHSEP == '\\' then
|
||||
if filename and PATHSEP == '\\' then
|
||||
filename = filename:gsub('[/\\]', '\\')
|
||||
local drive, rem = filename:match('^([a-zA-Z])(:.*)')
|
||||
return drive and drive:upper() .. rem or filename
|
||||
|
|
|
@ -589,18 +589,6 @@ function core.restart()
|
|||
end
|
||||
|
||||
|
||||
local function version_components(version)
|
||||
local a, b, c = version:match('(%d+)%.(%d+)%.(%d+)')
|
||||
if a then
|
||||
return tonumber(a), tonumber(b), tonumber(c)
|
||||
end
|
||||
a, b = version:match('(%d+)%.(%d+)')
|
||||
if a then
|
||||
return tonumber(a), tonumber(b)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function check_plugin_version(filename)
|
||||
local info = system.get_file_info(filename)
|
||||
if info ~= nil and info.type == "dir" then
|
||||
|
@ -612,12 +600,19 @@ local function check_plugin_version(filename)
|
|||
if not f then return false end
|
||||
local version_match = false
|
||||
for line in f:lines() do
|
||||
local version = line:match('%-%-%s*lite%-xl%s*(%d+%.%d+)%s*$')
|
||||
if not version then break end
|
||||
local ver_major, ver_minor = version_components(version)
|
||||
local ref_major, ref_minor = version_components(VERSION)
|
||||
version_match = (ver_major == ref_major and ver_minor == ref_minor)
|
||||
break
|
||||
local mod_version = line:match('%-%-.*%f[%a]mod%-version%s*:%s*(%d+)')
|
||||
if mod_version then
|
||||
version_match = (mod_version == MOD_VERSION)
|
||||
break
|
||||
end
|
||||
-- The following pattern is used for backward compatibility only
|
||||
-- Future versions will look only at the mod-version tag.
|
||||
local version = line:match('%-%-%s*lite%-xl%s*(%d+%.%d+)$')
|
||||
if version then
|
||||
-- we consider the version tag 1.16 equivalent to mod-version:1
|
||||
version_match = (version == '1.16' and MOD_VERSION == "1")
|
||||
break
|
||||
end
|
||||
end
|
||||
f:close()
|
||||
return version_match
|
||||
|
|
|
@ -484,7 +484,8 @@ function Node:close_all_docviews()
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
-- Returns true for nodes that accept either "proportional" resizes (based on the
|
||||
-- node.divider) or "locked" resizable nodes (along the resize axis).
|
||||
function Node:is_resizable(axis)
|
||||
if self.type == 'leaf' then
|
||||
return not self.locked or not self.locked[axis] or self.resizable
|
||||
|
@ -496,22 +497,42 @@ function Node:is_resizable(axis)
|
|||
end
|
||||
|
||||
|
||||
-- Return true iff it is a locked pane along the rezise axis and is
|
||||
-- declared "resizable".
|
||||
function Node:is_locked_resizable(axis)
|
||||
return self.locked and self.locked[axis] and self.resizable
|
||||
end
|
||||
|
||||
|
||||
function Node:resize(axis, value)
|
||||
if self.type == 'leaf' then
|
||||
-- The logic here is: accept the resize only if locked along the axis
|
||||
-- and is declared "resizable". If it is not locked we don't accept the
|
||||
-- If it is not locked we don't accept the
|
||||
-- resize operation here because for proportional panes the resize is
|
||||
-- done using the "divider" value of the parent node.
|
||||
if (self.locked and self.locked[axis]) and self.resizable then
|
||||
assert(self.active_view.set_target_size, "internal error: the view of a resizable \"locked\" node do not provide a set_target_size method")
|
||||
if self:is_locked_resizable(axis) then
|
||||
return self.active_view:set_target_size(axis, value)
|
||||
end
|
||||
else
|
||||
local a_resizable = self.a:is_resizable(axis)
|
||||
local b_resizable = self.b:is_resizable(axis)
|
||||
if a_resizable and b_resizable then
|
||||
self.a:resize(axis, value)
|
||||
self.b:resize(axis, value)
|
||||
if self.type == (axis == "x" and "hsplit" or "vsplit") then
|
||||
-- we are resizing a node that is splitted along the resize axis
|
||||
if self.a:is_locked_resizable(axis) and self.b:is_locked_resizable(axis) then
|
||||
local rem_value = value - self.a.size[axis]
|
||||
if rem_value >= 0 then
|
||||
return self.b.active_view:set_target_size(axis, rem_value)
|
||||
else
|
||||
self.b.active_view:set_target_size(axis, 0)
|
||||
return self.a.active_view:set_target_size(axis, value)
|
||||
end
|
||||
end
|
||||
else
|
||||
-- we are resizing a node that is splitted along the axis perpendicular
|
||||
-- to the resize axis
|
||||
local a_resizable = self.a:is_resizable(axis)
|
||||
local b_resizable = self.b:is_resizable(axis)
|
||||
if a_resizable and b_resizable then
|
||||
self.a:resize(axis, value)
|
||||
self.b:resize(axis, value)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -619,7 +640,10 @@ end
|
|||
|
||||
|
||||
local function resize_child_node(node, axis, value, delta)
|
||||
local accept_resize = node.a:resize(axis, value) or node.b:resize(axis, node.size[axis] - value)
|
||||
local accept_resize = node.a:resize(axis, value)
|
||||
if not accept_resize then
|
||||
accept_resize = node.b:resize(axis, node.size[axis] - value)
|
||||
end
|
||||
if not accept_resize then
|
||||
node.divider = node.divider + delta / node.size[axis]
|
||||
end
|
||||
|
@ -645,7 +669,7 @@ function RootView:on_mouse_moved(x, y, dx, dy)
|
|||
node.divider = common.clamp(node.divider, 0.01, 0.99)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
self.mouse.x, self.mouse.y = x, y
|
||||
self.root_node:on_mouse_moved(x, y, dx, dy)
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
-- this file is used by lite-xl to setup the Lua environment
|
||||
-- when starting
|
||||
VERSION = "1.16.7"
|
||||
VERSION = "1.16.9"
|
||||
MOD_VERSION = "1"
|
||||
|
||||
SCALE = tonumber(os.getenv("LITE_SCALE")) or SCALE
|
||||
PATHSEP = package.config:sub(1, 1)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local core = require "core"
|
||||
local common = require "core.common"
|
||||
local config = require "core.config"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local core = require "core"
|
||||
local config = require "core.config"
|
||||
local Doc = require "core.doc"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local core = require "core"
|
||||
local command = require "core.command"
|
||||
local common = require "core.common"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local syntax = require "core.syntax"
|
||||
|
||||
syntax.add {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local syntax = require "core.syntax"
|
||||
|
||||
syntax.add {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local syntax = require "core.syntax"
|
||||
|
||||
syntax.add {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local syntax = require "core.syntax"
|
||||
|
||||
syntax.add {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local syntax = require "core.syntax"
|
||||
|
||||
syntax.add {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local syntax = require "core.syntax"
|
||||
|
||||
syntax.add {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local syntax = require "core.syntax"
|
||||
|
||||
syntax.add {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local syntax = require "core.syntax"
|
||||
|
||||
syntax.add {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local core = require "core"
|
||||
local command = require "core.command"
|
||||
local keymap = require "core.keymap"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local core = require "core"
|
||||
local common = require "core.common"
|
||||
local keymap = require "core.keymap"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local core = require "core"
|
||||
local command = require "core.command"
|
||||
local keymap = require "core.keymap"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local core = require "core"
|
||||
local config = require "core.config"
|
||||
local command = require "core.command"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local core = require "core"
|
||||
local command = require "core.command"
|
||||
local translate = require "core.doc.translate"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local core = require "core"
|
||||
local common = require "core.common"
|
||||
local command = require "core.command"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local core = require "core"
|
||||
local common = require "core.common"
|
||||
local command = require "core.command"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local core = require "core"
|
||||
local command = require "core.command"
|
||||
local Doc = require "core.doc"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- lite-xl 1.16
|
||||
-- mod-version:1 -- lite-xl 1.16
|
||||
local core = require "core"
|
||||
local common = require "core.common"
|
||||
local DocView = require "core.docview"
|
||||
|
|
|
@ -12,6 +12,18 @@ static int query_surface_scale(RenWindow *ren) {
|
|||
assert(w_pixels % w_points == 0 && h_pixels % h_points == 0 && w_pixels / w_points == h_pixels / h_points);
|
||||
return w_pixels / w_points;
|
||||
}
|
||||
|
||||
static void setup_renderer(RenWindow *ren, int w, int h) {
|
||||
/* Note that w and h here should always be in pixels and obtained from
|
||||
a call to SDL_GL_GetDrawableSize(). */
|
||||
if (ren->renderer) {
|
||||
SDL_DestroyTexture(ren->texture);
|
||||
SDL_DestroyRenderer(ren->renderer);
|
||||
}
|
||||
ren->renderer = SDL_CreateRenderer(ren->window, -1, 0);
|
||||
ren->texture = SDL_CreateTexture(ren->renderer, SDL_PIXELFORMAT_BGRA32, SDL_TEXTUREACCESS_STREAMING, w, h);
|
||||
ren->surface_scale = query_surface_scale(ren);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -23,7 +35,7 @@ void renwin_init_surface(RenWindow *ren) {
|
|||
int w, h;
|
||||
SDL_GL_GetDrawableSize(ren->window, &w, &h);
|
||||
ren->surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 32, SDL_PIXELFORMAT_BGRA32);
|
||||
ren->surface_scale = query_surface_scale(ren);
|
||||
setup_renderer(ren, w, h);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -60,20 +72,6 @@ SDL_Surface *renwin_get_surface(RenWindow *ren) {
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef LITE_USE_SDL_RENDERER
|
||||
static void setup_renderer(RenWindow *ren, int w, int h) {
|
||||
/* Note that w and h here should always be in pixels and obtained from
|
||||
a call to SDL_GL_GetDrawableSize(). */
|
||||
if (ren->renderer) {
|
||||
SDL_DestroyRenderer(ren->renderer);
|
||||
SDL_DestroyTexture(ren->texture);
|
||||
}
|
||||
ren->renderer = SDL_CreateRenderer(ren->window, -1, 0);
|
||||
ren->texture = SDL_CreateTexture(ren->renderer, SDL_PIXELFORMAT_BGRA32, SDL_TEXTUREACCESS_STREAMING, w, h);
|
||||
ren->surface_scale = query_surface_scale(ren);
|
||||
}
|
||||
#endif
|
||||
|
||||
void renwin_resize_surface(RenWindow *ren) {
|
||||
#ifdef LITE_USE_SDL_RENDERER
|
||||
int new_w, new_h;
|
||||
|
@ -89,11 +87,6 @@ void renwin_resize_surface(RenWindow *ren) {
|
|||
|
||||
void renwin_show_window(RenWindow *ren) {
|
||||
SDL_ShowWindow(ren->window);
|
||||
#ifdef LITE_USE_SDL_RENDERER
|
||||
int w, h;
|
||||
SDL_GL_GetDrawableSize(ren->window, &w, &h);
|
||||
setup_renderer(ren, w, h);
|
||||
#endif
|
||||
}
|
||||
|
||||
void renwin_update_rects(RenWindow *ren, RenRect *rects, int count) {
|
||||
|
@ -118,8 +111,8 @@ void renwin_free(RenWindow *ren) {
|
|||
SDL_DestroyWindow(ren->window);
|
||||
ren->window = NULL;
|
||||
#ifdef LITE_USE_SDL_RENDERER
|
||||
SDL_DestroyRenderer(ren->renderer);
|
||||
SDL_DestroyTexture(ren->texture);
|
||||
SDL_DestroyRenderer(ren->renderer);
|
||||
SDL_FreeSurface(ren->surface);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue