Commit Graph
2365 Commits
Author SHA1 Message Date
takase1121 2e2305b9fe arena_allocator: return lxl_arena instead of initializing an existing struct 2024-11-27 20:53:33 +08:00
takase1121 cf40e254fe process: migrate arg validation and checking to Lua 2024-11-27 20:53:32 +08:00
takase1121 f84305b2b2 utfconv: add functions that use arena_allocator 2024-11-25 21:29:33 +08:00
takase1121 14489482ec allocator: add arena_allocator
This allocator uses Lua userdatas for dynamic allocation
that is automatically freed when the current scope exits.
2024-11-25 21:29:28 +08:00
Janandtakase1121 f0d7e22dbf remove lhelper script, build configuration and dependency support (#1906)
* remove lhelper script, build configuration and dependency support

* turn lhelper flag into a error
2024-11-25 21:29:22 +08:00
Guldomanandtakase1121 8c66c5f493 treeview: remove unused code (#1895)
It caused a lot of useless `system.absolute_path` calls.
2024-11-25 21:29:05 +08:00
Guldomanandtakase1121 f6558995fa meta: remove FUNDING.yml 2024-11-25 21:28:57 +08:00
Adamandtakase1121 49a1ec32b8 Add keyboard shortcut to tooltips in ToolbarView (#1880) 2024-11-25 21:28:47 +08:00
Takase 55d84ea1a8 ci: use lite-xl-build-box-manylinux (#1877) 2024-11-25 21:28:29 +08:00
Takase 7a603f2a2d renderer: rewrite glyph cache (#1845)
* renderer: rewrite glyph cache

This commit splits the current GlyphSet-based system into 2 caches,
CharMap and GlyphMap, which maps codepoints -> glyph IDs and glyph IDs -> glyphs respectively.
Each GlyphMap contains a number of GlyphAtlas mapped by their width,
and each GlyphAtlas has a list of surfaces with the same width.
Surfaces within the GlyphAtlas acts like a bump allocator, but is flexible
enough to allow older GlyphAtlas surfaces to be recycled.

GlyphMetric now contains atlas_idx and surface_idx, which points to the correct surface.
Since GlyphAtlas supports rudimentary packing & allocation, we no longer render whole
GlyphSets and this speeds up rendering in most cases.

Tab width is no longer set with the hacky "modify the GlyphMetric" hack.

* renderer: set natlas to 0 after freeing

* renderer: fix printf warning

* renderer: fix memory leak

* renderer: better whitespace rendering

* renderer: fix ubsan warning when casting ints

* renderer: fix tab handling

There's a bug with inconsistent tab widths caused by fontgroups.

* renderer: fix glyphs being loaded over and over

* renderer: add glyphmap size

* renderer: store per-surface offset_y and use it to find best-fitting surface

* renderer: fix MSVC compiler error

* renderer: remove return value from ren_font_glyph

* renderer: refactor xadvance calculation

* renderer: fix double free SDL_RWops if FT_Set_Pixel_Size fail

* renderer: always try .notdef before U+25A1

* renderer: disable ren_font_dump yet again

Accidentally commited this change.

* renderer: remove unused imports

* renderer: fix double free with FT_Open_Face

* renderer: return SDL_Surface in font_find_glyph_surface

* renderer: bring back metric flags for future extension

* renderer: refactor xadvance calculation into macro

* renderer: fix comment

* renderer: store GlyphMetric directly in the surface

* renderer: remove duplicated comment

* renderer: rename font_find_glyph_surface to font_allocate_glyph_surface

* renderer: refactor glyphmetric retrieval into an inline function

* renderer: do not render glyphs with bitmap set to null

This is a weird edge case, but at least it shouldn't crash

* renderer: refactor face metric code into its own function

* renderer: actually check if glyph fits in surface

* renderer: rudimentary support for non-scalable faces

At least it won't render nothing on the screen

* renderer: check for font_surface instead of metric directly

This is safe and shorter

* renderer: fix indentation

* renderer: rename GLYPH_PER_ATLAS to GLYPHS_PER_ATLAS

* renderer: rename all GLYPH_PER_ATLAS correctly

* renderer: make utf8_to_codepoint slightly more durable

* renderer: fix compiler unsigned cast warning
2024-11-25 21:27:03 +08:00
kramoandtakase1121 91a30099f7 macos: Add proper platform-specific icon 2024-11-25 21:08:48 +08:00
takase1121 4d803204a8 src/renwindow: correctly free texture and renderer 2024-11-25 21:04:45 +08:00
aia29andtakase1121 4e3558322c add cuda 2024-11-25 21:03:11 +08:00
takase1121 af9c8344cf chore: update versions 2024-06-29 22:46:15 +08:00
takase1121 e7c659c4e1 chore: changelogs for v2.1.5 2024-06-29 22:46:15 +08:00
takase1121 1140ceca94 ci/release: adapt release note generation to the new script 2024-06-29 22:46:14 +08:00
takase1121 474d696c84 resources,scripts: use gh cli to fetch the correct release tags 2024-06-29 22:46:14 +08:00
takase1121 4bfcd0d16e core/doc: fix wrong table index in Doc:merge_cursors
it was off by 1
2024-06-24 22:29:05 +08:00
Guldomanandtakase1121 71913e1b86 fix(doc): convert Doc:merge_cursors parameter from "selection index" to table index 2024-06-24 22:29:05 +08:00
takase1121 5ba8cfde6d core/rootview: fix dnd multiple folders into dock 2024-06-23 13:09:52 +08:00
Guldomanandtakase1121 52dd76add6 fix(autoreload): wait a second before automatically reloading a file (#1823)
This is needed because we use `mtime` to determine if a file has actually changed, but on most systems this has a resolution of 1 second (and we truncate it to an integer anyways).

Without this wait, we would skip reloading a file that has been changed multiple times in the same `mtime` second, thus losing some data.
2024-06-23 10:08:08 +08:00
Guldomanandtakase1121 ea5c1ee628 fix(dirmonitor): avoid calling the change callback multiple times in the same notification (#1824) 2024-06-23 10:08:08 +08:00
fgelm01andtakase1121 9c7f1bede4 Handle static constexpr in language_cpp (#1806) 2024-06-23 10:08:08 +08:00
Takase ce70fcf5dd macos: support drag-and-drop and default file associations (#1822)
* macos: support drag-and-drop and default file associations

* resources/macos: use LSItemContentTypes to narrow down files

* macos: support opening folders

* rootview: workaround macos weird dnd event timing

* core/rootview: rename variable and refactor if statement
2024-06-23 10:08:08 +08:00
Guldomanandtakase1121 214602d17a Update font scale on monitor scale change for RENDERER backend (macOS) (#1650)
* Update font scale on monitor scale change for `RENDERER` backend (macOS)

* fix(renderer): check every font of a fontgroup for scale changes in `update_font_scale`

It is needed because fonts can be reused between groups and outside of them.
So if the first font of a group has already been scaled, we still need to check if the others still needs to be scaled.
2024-06-23 09:02:56 +08:00
2f32806426 Update language_python.lua (#1723)
* Update language_python.lua

* Update language_python.lua

* Update language_python.lua

* implemented a better `python_type` subsyntax

* Update language_python.lua

* fixed a small error where you couldn't hint a type at a var and guive it a value at the same time

* Update language_python.lua

* Update language_python.lua

Dictionaries appear now normally

* Update language_python.lua

* added suggestions concerning strings

* commited suggestion

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>

* Various changes

* Update language_python.lua

Syntax more optimized but a tiny bit more complex...

* Simplified everything

---------

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
2024-06-23 09:02:56 +08:00
fgelm01andtakase1121 2679ac9d83 Add support for binary integer literals. (#1819) 2024-06-23 09:02:56 +08:00
Takase a8e5941337 language_cpp: backport number highlighting from c (#1818) 2024-06-23 09:02:56 +08:00
ThaCuberandtakase1121 28edec36e8 improve number highlighting for c (#1752)
* improve number highlighting for c

* add unsigned suffix

* add long suffixes

* reorder octal literals and add suffix for hex numbers

* fix integer and float suffixes
too many characters, send help
2024-06-23 09:02:55 +08:00
Takase c43996cf36 resources/macos: better macos installer background (#1816) 2024-06-23 09:02:55 +08:00
TakaseandGuldoman c3fa3859f2 subprojects: update lua,pcre2,sdl2 (#1812)
* subprojects: update lua,pcre2,sdl2

* meson.build: remove hidapi usage

* subprojects/sdl2: fix compilation with xinput

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>

---------

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
2024-06-23 09:02:55 +08:00
Takase 64b7625b62 Update macOS copyright notice (#1815)
* resources: update copyright in info.plist

* meson.build: dynamically generate current year

"present" may be misleading.

* resources/macos: remove unecessary newlines
2024-06-23 09:02:55 +08:00
Takase 8782c8064f ci: use latest macos images (#1804)
* ci: use latest macos images

* ci/build: clarify the purpose of md5sha1sum

* meson.build: remove hidapi usage

* ci: downgrade macos version for universal build

* scripts: codesign the universal binary with sha1 and sha256

* ci: revert back to macos-14 for universal

* ci/build: remove old comment
2024-06-23 09:02:55 +08:00
Janandtakase1121 b8e4b30912 Update labeler config for new version (#1805)
* Update labeler config for new version

* Fix indent

---------

Co-authored-by: Takase <20792268+takase1121@users.noreply.github.com>
2024-06-23 09:02:55 +08:00
Takase 8432499f98 Update action dependencies (#1724)
* CI: update various action versions

The most significant change is action/upload-artifact@v4,
which does not support uploading artifacts of the same name.
This makes our lives significantly worse, but I don't know
if GitHub will remove v3 in future or not.

* CI: fix macOS universal artifact download

* CI: update release action versions

* CI: use containers only for building

* CI: fix multiline commands

* CI: try to fix multiline strings again

* CI: fix multiline strings again ugh

* CI: Fix ccache in containers

* CI: Fix quotes again

* CI: fix ccache

* CI: fix deprecated set-output command

* ci: update build box to v2.1.2

* ci: revert to softprops/action-gh-release

* ci: add name to release

* ci: remove name again

* ci: fix wrong outputs reference

* ci: add name

* ci: add missing name for each step

* ci: format yaml files

* ci/release: add names to unamed entries

* ci/release: fix MSYS2 not downloading deps

* ci/release: change to ncipollo/release-action

There is some weird issue with softprops/action-gh-release and I can't update an existing release.

* ci/release: allow updating releases

* ci/release: upload all artifacts, then download them at once

* ci/release: use a better name for job

* ci/release: add release as dependency

* ci/release: set tag for update release

* ci/auto-labeler: remove workaround for old autolabeler issue

* ci/release: remove the need of another bash -c

* ci/release: remove weird bash -c
2024-06-23 09:02:55 +08:00
Takase 6e7bcff493 ci: fix typo in release note template (#1801) 2024-06-23 09:02:54 +08:00
Guldomanandtakase1121 9fb5d299f9 fix: avoid iterating over a changing table in run_threads (#1794)
* fix: avoid iterating over a changing table in `run_threads`

This is done to avoid iterating over a table that can change in the meantime.
More precisely the issue appears if a thread is removed from the table, we yield early from `run_threads` because we reached the end of the frame, and a new thread is added before the next iteration.

For example:
```lua
local lost_time = false
core.add_thread(function()
  -- force early yield
  local t0 = system.get_time()
  while system.get_time() - t0 < .1 do end
  lost_time = true
end, "a")

local step = core.step
function core.step()
  if lost_time then
    -- add a new thread while run_threads hasn't finished iterating
    core.add_thread(function()end, "a1")
    lost_time = false
  end
  return step()
end
```
would crash with `invalid key to 'next'`.

* fix: only run coroutine if it wasn't removed

* fix: don't handle `core.threads` table as an array

This caused some entries to be skipped or even removed erroneously.
2024-06-23 09:02:46 +08:00
fgelm01andtakase1121 3d692cf5a6 Change co_wait to co_await in language_cpp (#1800)
The C++20 keyword is spelled `co_await`.
2024-06-21 08:06:53 +08:00
Takase e9a40c615f api/system: fix newlines returned by get_clipboard (#1788) 2024-06-21 08:06:44 +08:00
Takase bab7b3caf9 Generate release notes (#1774)
* ci: generate better release notes

* scripts: rename generate-release-note.sh

* ci/release: check out all the history

* ci/release: accept version from input
2024-06-21 08:06:18 +08:00
Guldomanandtakase1121 8989dd6dc9 build: fix dirmonitor backend selection (#1790)
When a backend was specified using meson, the relative source files weren't being added.
2024-06-21 08:05:35 +08:00
takase1121 f4311df1d6 chore: update version 2024-04-16 18:47:51 +08:00
takase1121 71d25f34b3 chore: update changelog 2024-04-15 11:47:00 +08:00
Takase c449632e85 ci: fix missing permission for creating releases (#1770) 2024-04-15 11:45:05 +08:00
takase1121 79b2457556 chore: update version 2024-04-15 10:39:36 +08:00
takase1121 bf35573725 changelog: add changes for 2.1.4 2024-04-15 10:32:25 +08:00
Guldomanandtakase1121 67202c7284 Skip patterns matching nothing in tokenizer (#1743)
These patterns cause infinite loops, so warn about them and skip them.
2024-04-15 09:02:17 +08:00
Andrei Vincaandtakase1121 ae4a27c797 Fix BufferSize in g_read for Windows (#1722) 2024-04-15 09:02:00 +08:00
PerilousBookletandtakase1121 4299909cd3 Added Arduino syntax highlighting support alongside C++. (#1767) 2024-04-15 08:50:13 +08:00
PerilousBookletandtakase1121 48712a242d Fixed some typos in core.init (#1755)
* Fixed some typos.

* Update data/core/init.lua

Co-authored-by: Takase <20792268+takase1121@users.noreply.github.com>

* Update data/core/init.lua

Co-authored-by: Takase <20792268+takase1121@users.noreply.github.com>

---------

Co-authored-by: Takase <20792268+takase1121@users.noreply.github.com>
2024-04-15 08:49:40 +08:00