Commit Graph

2212 Commits

Author SHA1 Message Date
Takase 82589526c0
fix: dim rendering when antialiasing is turned off (#1641) 2023-10-16 12:05:01 +08:00
Guldoman 316fbbe743
Remove DPI detection for default `SCALE`
This often leads to `SCALE` values that are way off, and makes Lite XL 
unusable, so we now just default it to 1.
2023-10-16 12:04:37 +08:00
Guldoman 784b911d41
Make `linewrapping` consider the expanded `Scrollbar` size
This avoids reflowing the text when hovering the scrollbar.
2023-09-13 08:05:35 +08:00
Robert Hildebrandt a9934c08d9
Fixed C++14 digit separators (#1593) 2023-09-13 08:04:05 +08:00
Guldoman 397b61e7c6
Fix returned `percent` when clicking the `Scrollbar` `track` 2023-08-26 08:56:35 +08:00
Takase 890e4882f3
fix(core): defer core:open-log until everything is loaded (#1585)
* fix(core): defer core:open-log until everything is loaded

* docs(core): document why core:open-log is opened in a thread
2023-08-26 08:53:05 +08:00
Takase 09dd111c61
docs(core.contextmenu): add documentation for contextmenu (#1567) 2023-08-26 08:52:29 +08:00
Jan d937693ddb
Use Lua wrap by default (#1481)
Debian and all its derivatives ship a broken Lua 5.4 that is missing some symbols.
To work around broken distros and make development and distribution easier use the wrap by default and add an option to use the system version.
2023-08-26 08:52:25 +08:00
Guldoman 3d93e16597
Normalize strokes in fixed order (#1572)
* Use normalized strokes when removing duplicates only when appropriate

* Use normalized stroke in `keymap.unbind`

* Normalize strokes by sorting the modifiers before the keys

This also sorts the modifiers in a fixed manner, decided by 
`modkeys.keys`.
We need to do this because we display the strokes in a few places like 
the command palette.
2023-08-26 08:52:10 +08:00
Takase eb27e543b4
ci(release): use lite-xl org (#1571) 2023-08-19 13:31:40 +08:00
Guldoman 86cfbe5f3b
Make `DocView` aware of scrollbars sizes (#1177)
* Make `DocView:scroll_to_make_visible` aware of vertical scrollbar width

* Make `DocView` aware of horizontal scrollbar size
2023-08-19 13:31:37 +08:00
Adam Harrison c279ef0034
Updated README.md as per PR comittee meeting #8. 2023-08-19 13:31:31 +08:00
Shreyas A S 9120fb0046
Updating the *Installing prebuild* section in README.md (#1548)
Sub sections that I've updated:
*To run lite-xl without installing:*
*To install lite-xl copy files over into appropriate directories:*

I think the directory structure of prebuilt packages has changed since when README.md was last updated. I've just updated it. Just that.

Co-authored-by: Shreyas A S <137637016+shreyasastech@users.noreply.github.com>
2023-08-19 13:31:27 +08:00
Delta-official e62a672d7e
Normalize stroke before adding keybind (#1334)
* Normalize stroke before adding keybind

* improve normalization algorithm and implement normalization in several functions

Signed-off-by: delta <darkussdelta@gmail.com>

---------

Signed-off-by: delta <darkussdelta@gmail.com>
2023-08-19 13:31:19 +08:00
Takase 07818934b6
feat(src/renderer): unify fontgroup baseline (#1560)
* feat(src/renderer): unify fontgroup baseline

* fix(src/renderer): use the first font's baseline for the text run
2023-08-19 13:31:18 +08:00
Takase 5d0bcc99fa
Documentation for core.command (#1564)
* docs(core.command): add documentation

* fix(core.common): fix warnings

* docs(core.command): add "core." prefix to all custom types

* docs(core.command); add name as parameter to command.perform

* docs(core.command): fix typo and wording

* docs(core.command): add disclaimer to command.generate_predicate

* docs(core.command): fix wording for predicate

* docs(core.command): document command name

* docs(core.command): document the always_true predicate
2023-08-19 13:30:45 +08:00
Takase b5b6682303
docs(system): fix missing parameter for system.path_compare (#1566)
* docs(system): fix missing parameter for system.path_compare

* docs(system): fix missing parameter in function prototype
2023-08-19 13:30:45 +08:00
Takase ad0d280ecc
Documentation for core.common (#1510)
* docs(core.common): add and improve documentation

* refactor(core.common): remove unused variable to get_height()

* docs(core.common): remove messy newlines

* docs(core.common): fix wording

* docs(core.common): use integer instead of number

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

* docs(core.common): update docs

the docs now follow the style in docs/ directory.
some of the changes suggested are also implemented.

* docs(core.common): fix typo

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

* docs(core.common): restyle annoatations

Extra whitespaces are removed and @overload is used whenever possible.

* docs(core.common): fix various documentation errors

* docs(core.common): simplify unicode description

* docs(core.common): fix return value

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

* docs(core.common): clarify common.bench for not being a benchmark

* docs(common): add disclaimer for numbers in common.serialize

---------

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
2023-08-19 13:30:45 +08:00
Takase 553251834b
feat(src/renderer): stream fonts with SDL_RWops on all platforms (#1555)
* feat(src/renderer): stream fonts with SDL_RWops on all platforms

This fixes #1529 where the font itself carries the font file, which gets copied around.
This commit streams the file, so the file is not entirely in memory.

* style(src/renderer): use standard C types

* refactor(src/renderer): implement FT_Stream.close

* fix(src/renderer): fix SDL_RWops double free
2023-08-19 13:30:18 +08:00
Takase 7f84ed311b
style(src/renderer): use FreeType header names (#1554) 2023-08-19 13:29:49 +08:00
Guldoman f7400c924e
Allow setting custom glyphset size (#1542)
* Properly set glyphset size

* Rename `MAX_GLYPHSET` to `GLYPHSET_SIZE`

* Use more appropriate types for font metrics
2023-08-19 13:29:48 +08:00
Guldoman e9678cc140
Skip checking `files` if no filename was provided to `syntax.get` 2023-08-19 13:29:48 +08:00
Luke aka SwissalpS b5617a3eef
Fix #1538 log scrolls automatically (the real PR) (#1546)
* fix #1538 log scrolls automatically

adds:
- when user scrolls, position is kept no matter how many new entries
arrive
- when user scrolls up to last entry, autoscroll is enabled again

does not add buttons to jump up/down
see #1538

* move scroll-test out of on_mouse_wheel

* determine diff_index with loop

* remove check at move_towards yoffset

* use while loop instead of repeat loop

* remove meaningless setter

* remove stray var
2023-08-19 13:29:48 +08:00
Luke aka SwissalpS bd53bc3718
comment typo in object.lua (#1541) 2023-08-19 13:29:48 +08:00
Jan 2af3082640
Attach command buffer to Renderer Window (#1472) 2023-08-19 13:29:05 +08:00
Guldoman 964b8fe29d
Increase number of loadable glyphsets (#1524)
This should be enough to load every unicode codepoint.
2023-08-19 13:28:37 +08:00
Guldoman f1f81c8851
Make `Doc:sanitize_position` return a more appropriate `col` (#1469)
If `line` is out of range, return the `col` "closest" to the original
values.
2023-08-19 13:28:14 +08:00
Guldoman 68e9c4670e
Revert "core syntax: strip the path from filename on syntax.get (#1168)" (#1322)
* Revert "core syntax: strip the path from filename on syntax.get (#1168)"

This reverts commit af6c4bc152.

The previous behavior was correct and allowed access to the full path for path-dependant syntaxes.

* Use `Doc.abs_filename` to obtain syntax when possible

This allows matching full paths in language syntaxes, but we lose the
possibility of matching the project root.
2023-08-19 13:28:14 +08:00
Guldoman ff884d7d4a
When logging don't use `core.status_view` if not yet initialized 2023-08-19 13:27:31 +08:00
Guldoman 3febcf454c
Mark `linewrapping` `open_files` table as weak
We weren't correctly garbage-collecting `Doc`s, so we had `Highlighter`s 
stay alive over their due time.
2023-08-19 13:27:28 +08:00
Jefferson González 6c17f6e2ee
Close lua state when exiting on a runtime error (#1487)
* Close lua state when exiting on a runtime error

* This change allows calling the garbage collector before exiting the
  application for a cleaner shutdown.
* Components like the shared memory object on #1486 will have a better
  chance at destroying no longer needed resources.

* Overriden os.exit to always close the state

* Allow setting close param on os.exit override

* Simplified the os.exit override a bit more

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

---------

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
2023-08-19 13:27:02 +08:00
takase1121 2a9b367e13
Move lineguide below blinking cursor, fixes #1488 (#1511)
* Move lineguide below blinking cursor, fixes #1488

* Added config_spec custom color
2023-08-19 13:26:01 +08:00
takase1121 64e5fd8ead
fix(renderer): fix memory leak when freeing glyphsets 2023-08-19 12:47:19 +08:00
takase1121 4c320a10c0
docs(system): make all parameters for set_window_hit_test optional 2023-08-19 12:45:48 +08:00
Guldoman bd36b3f615
Restore horizontal scroll position after scale change (#494)
* Restore horizontal scroll position after scale change

* Consider `View` horizontal size when restoring horizontal scroll

This is needed because `View:get_h_scrollable_size` includes the 
horizontal size, while `View.scroll.x` doesn't.
2023-08-19 12:45:16 +08:00
takase1121 c0b1fe348f
feat(bootstrap): return error string from C searcher 2023-08-19 12:45:15 +08:00
takase1121 6111b071ec
fix(rencache): fix compiler warning for printing size_t 2023-08-19 12:45:15 +08:00
Adam Harrison 793af14dca
Fixing linewrapping bug to do with wordwrapping. 2023-08-19 12:45:15 +08:00
takase1121 2517d34113
ci(build): update action dependencies 2023-08-19 12:44:19 +08:00
Takase 1952848caa
fix(process): check for HANDLE_INVALID (#1475) 2023-08-19 12:44:19 +08:00
Jan 760271d416
Make `system.path_compare` more digit-aware (#1474)
This allows a human friendly sorting filenames with numbers in them
So
- asd1
- asd10
- asd2
becomes
- asd1
- asd2
- asd10
2023-08-19 12:44:18 +08:00
Takase 2fe1f52a1f
Process API improvements (again) (#1370)
* feat(process): add push_error
* refactor(process): use push_error for better errors
* style(process): consistent error messages
* refactor(process): reimplement process.strerror() with push_error
* refactor(process): implement close_fd only once
* refactor(process): rename process_handle to process_handle_t
* fix(process): prevent errors from a NULL error message
* refactor(process): refactor push_error into 2 functions
* fix(process): fix wrong error message
* fix(process): check if push_error_string actually pushed something
* refactor(process): make error messages descriptive
* fix(process): check for empty table instead of aborting
* refactor(process): make error messages descriptive on Windows
* refactor(process): rename process_stream_handle to process_stream_t
* refactor(process): fix wrong usage of process_handle_t
* fix(process): fix wrong type name
* refactor(process): incoporate kill_list_thread into process_kill_list_t
* refactor(process): make kill_list per-state data
2023-08-19 12:43:57 +08:00
Takase 64a6d88618
Build releases with Ubuntu 18.04 container (#1460)
* ci(release): try using lite-xl-build-box

* ci(build): test with my own fork

* ci(build): do not install python via actions

* ci(build): disable package updates

* fix(scripts/appimage.sh): add workaround for non-FUSE environments

* ci(build): document why the actions are disabled

* ci(release): fix typo
2023-08-19 12:43:56 +08:00
Guldoman 97f3159415
Merge carets after `doc:move-to-{previous,next}-char` (#1462) 2023-08-19 12:43:56 +08:00
Takase 8e57b71118
refactor(plugin_api): move the header into include/ (#1440) 2023-08-19 12:43:09 +08:00
Takase a44a7eafe8
Cross compiling improvements + macOS universal binary (#1458)
* chore(resources): rename macos_arm64.txt to macos-arm64.txt
   This matches the platform-arch convention like many other parts of the project.
* chore(resources/cross): rename wasm.txt to unknown-wasm32.txt
* refactor(scripts/common.sh): use parameter expansion instead of if else
* feat(scripts/common.sh): support custom arch and platform for get_default_build_dir
* feat(scripts/build.sh): add --cross-platform, --cross-arch and --cross-file
* feat(scripts/package.sh): add --cross-platform and --cross-arch
* feat(build-packages.sh): add support for new options in build.sh and packages.sh
* ci(build): make arm64 binaries in CI
* ci(build): do not install external libraries
* ci(build): fix invalid artifact name
* ci(build): fix INSTALL_NAME
* ci(build): change name for macos artifacts
* ci(build): add script to build universal dmgs from individual dmgs
* ci(build): build universal dmgs
* fix(make-universal-binaries): fix wrong path for hdiutil
* ci(build): rename macos action
* fix(make-universal-binaries.sh): fix wrong pathname for ditto
* ci(release): build macos universal binaries
* ci(release): remove useless variables
* ci(release): fix wrong dependency
* ci(build): fix old ubuntu version
   This version will be restored once I complete some container-specific fixes.
* ci(build): make build_macos_universal depend on release
* ci(build): fix wrong dmg dir
* style(ci): capitalize 'universal' for CI name
* fix(make-universal-binaries.sh): fix truncated dmg name when it contains dots
* ci: styling changes
* ci(release): install appdmg only
2023-08-19 12:42:31 +08:00
Takase 1fe90da664
upgrade header files to Lua 5.4 (#1436)
* refactor(native_api_header): upgrade header files to Lua 5.4.

Almost all of the symbols in this file was from 5.2. This will obviously
not work because some function signatures have changed and some have
completely wrong return values, etc.
This commit updates the header files to Lua 5.4 based on the source code
and changes a few things.

* refactor(plugin_api): move the header into include/

* fix(lite_xl_plugin_api.h): include stdlib to avoid errors with exit

* refactor(lite_xl_plugin_api.h): do not return in SYMBOL_WRAP_CALL

* fix(lite_xl_plugin_api.h): fix wrong way of passing varargs

* fix(lite_xl_plugin_api.h): fix differing lua_rawlen definition

* fix(lite_xl_plugin_api.h): fix fallback function signature

* fix(lite_xl_plugin_api.h): fix conversion from void * to function pointer
2023-08-19 12:42:31 +08:00
Jefferson González 0d0f1b00d9
Fix for api_require wrong macro && conditions (#1465)
This mistake escaped my eyes when reviewing #1437 and causes
some symbols to not be exported, because the preprocessor macros
are expecting multiple LUA versions to evaluate as true at once.
The fix is to replace `&&` with `||`.
2023-08-19 12:42:31 +08:00
vqn f60228f610
#1393 followup (#1463)
* Fix incorrect check in doc:raw_remove

Restore caret position on command doc:cut

* merge cursors and fix new line in clipboard

* add new line to the last copied line
2023-08-19 12:41:57 +08:00
Guldoman d497402c30
Make `system.path_compare` more case-aware (#1457)
* Use Lua-provided string lengths for `system.path_compare`
* Make `system.path_compare` more case-aware
   Before, strings like `README.md` would be sorted before `changelog.md`, 
   because we only looked at the raw ascii values.
   Now the character case is considered as a secondary sorting key.
2023-08-19 12:41:56 +08:00