Commit Graph

2347 Commits

Author SHA1 Message Date
Takase 246d4fc93f
fix(process): check for HANDLE_INVALID (#1475) 2023-04-18 21:02:10 -04:00
Jan 76ec16f299
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-04-18 14:55:25 -04:00
jgmdev 8cb842549c StatusView compat fix with older Lua runtimes 2023-04-17 17:26:24 -04:00
Takase a3a1c5d069
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-04-17 14:56:04 -04:00
Takase 0cf47fec5d
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-04-16 15:18:40 +02:00
Guldoman a6d1fe720f
Merge carets after `doc:move-to-{previous,next}-char` (#1462) 2023-04-14 17:49:26 -04:00
Takase 3f8dedd845
refactor(plugin_api): move the header into include/ (#1440) 2023-04-14 15:45:46 -04:00
Guldoman 80876ebc7c
Show error message in crash message box (#1461)
* Save to `error.txt` the same traceback shown on stdout
* Show error message in crash message box
2023-04-14 15:22:22 -04:00
Takase 702c7a9eb3
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-04-11 11:33:34 -04:00
Takase c9382419c2
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-04-11 11:20:28 -04:00
Jefferson González d4bf839b3d
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-04-11 03:29:31 +02:00
sammyette 2c1a0baccf
feat: add statusview item to show selections (#1445) 2023-04-10 18:16:41 -04:00
vqn 1f1b7fc1ef
#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-04-10 21:57:11 +02:00
Guldoman 6d4bf4ff90
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-04-07 14:41:32 -04:00
Takase 4b97752301
Update api_require to expose more symbols (#1437)
* feat(system): update api_require for more symbols
* fix(system): fix missing 5.1 symbols
* fix(system): add more missing symbols
* fix(system): add all symbols
   We got'em this time. I swear.
* fix(system): fix undefined symbols due to conditional compilation
   There is only pain and suffering.
   Turns out some of the symbols are only exported when the options are enabled.
   We need to preprocess the header.
2023-04-07 13:45:28 -04:00
Takase 7eaa85848c
Optimizing MSYS2 CI (#1435)
* feat(ci): install dependencies on setup
* fix(ci): don't update msys2 when setup
* fix(ci): download subprojects before patching
* doc(ci): document why meson subprojects download is called
2023-04-07 13:25:31 -04:00
Takase 1c01d6c296
fix(CI): bump dependency versions (#1434)
* refactor(ci): use microsoft/setup-msbuild
* fix(ci): fix wrong option name for setup-msbuild
* fix(ci): bump setup-python version
* fix(lua-utf8-patch): enable support for windows vista and above
* fix(ci): use vs backend
* fix(ci): reconfigure project manually after patch
* fix(ci): add a separate build step
* fix(ci): use msvc-dev-cmd again
2023-04-07 13:24:27 -04:00
Takase 6313b3d274
fix: fix differing stacktrace on stdout and file (#1404)
* fix(c-bootstrap): produce identical stack traces
2023-04-07 13:18:16 -04:00
Jan 34ba4dbee6
Add View dragging (#1402) 2023-04-07 13:15:50 -04:00
Takase 6619a2e1ea
fix(windows-utf8-patch): fix os.getenv() not supporting UTF-8 output (#1397) 2023-04-07 13:11:01 -04:00
Takase ecb599e61b
Fix invalid EXEFILE and EXEDIR on Windows (#1396)
* fix(main): fix get_exe_filename returning invalid result on Windows
* fix(main): fix bootstrap not intepreting UTF-8 properly
2023-04-07 13:06:01 -04:00
Adam a0de8ea81d
Added in support for foreground and background events. (#1395) 2023-04-07 12:58:56 -04:00
vqn 45e0454a3b
add autocompletion to multicursor (#1394)
* use Doc:remove
2023-04-07 12:54:52 -04:00
vqn f3cfb90ccf
fix cursors positions when deleting multiple selections (#1393)
* correctly handle overlapping selections merge cursors in Doc:raw_remove
2023-04-07 12:54:00 -04:00
Adam 1a0d3a4a03
Added in explicit touchscreen keyboard support. (#1389) 2023-04-07 12:42:46 -04:00
Guldoman 86fa90a76b
Allow `tokenizer` to pause and resume in the middle of a line (#1444) 2023-04-01 12:12:39 -04:00
Adam dc2ae6dd9c
Disable `trimwhitespace` and `drawwhitespace` via their configs (#1446)
Instead of completely disabling them, we now use their internal toggle.

Also moved `drawwhitespace` commands inside the plugin.

---

* Fixed bug where commands would show even when plugin was disbled. Also removed antiquated way of disabling.

* Fixed typos.

* Also moved trimwhitespace out of config, if it already has a default enabled value of false.

* Changed documentation.

* Clarified comments.
2023-03-29 01:57:24 +02:00
Guldoman e8c317494a
Limit `core.threads` without a timeout to run 30 times per second 2023-03-29 00:33:29 +02:00
Adam Harrison 3306fc99c1 Made things clearer, as per jgm's suggestion. 2023-03-28 14:17:30 -04:00
Adam 2cae7c51a5
Made coroutines make more sense, and fixed a bug. (#1381)
* Made coroutines make more sense, and fixed a bug.

* Fixed typo.

* Additional checking for off-cycles.

* Fixed issue with calling step too much.

* If we have no redraw, set next step time for next frame.

* Added in `now` variables to reduce calls.
2023-03-28 12:57:47 -04:00
Guldoman c92d7dc239
Don't calculate widths per-uft8-char when not needed (#1409) 2023-03-28 01:17:11 +02:00
Takase 0cacaf940b
Asynchronous process reaping (#1412)
* refactor(process): introduce process_stream_handle separate from process_handle

* feat(process): introduce process_handle helper functions

* feat(process): add asynchronous process reaping

* feat(process): wait for shorter period if possible

* style(process): remove unecessary brackets

* style(process): fix parentheses

* refactor(process): remove useless setvbuf call

* style(process): remove unecessary value

* refactor(process): add size field into kill_list

* refactor(process): use SDL_Delay for sleeping

* style(process): remove trailing whitespace

* fix(main): destroy window before closing lua

* fix(process): check for timeout correctly

* refactor(process): remove unecessary if check

* refactor(process): remove size from the list

* fix(process): fix invalid delay calculation

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

---------

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
2023-03-22 13:36:05 +01:00
Guldoman 2cdf5d8949
Aggregate `SDL_Surface`s and their scale in `RenSurface` (#1429) 2023-03-19 15:39:52 -04:00
Guldoman d15108309c
Make `TreeView` follow the current tab (#1411)
* Make `TreeView` follow the current tab

* Use `TreeView:toggle_expand` in `TreeView:set_selection_to_path`

We can't use `item.expanded` directly because we need to update the 
cached tree structure.
2023-03-16 17:29:33 -04:00
Guldoman 18720665d2
Use clipping functions provided by SDL (#1426) 2023-03-14 11:39:00 -04:00
Guldoman ed9bb3c85d
Improve text width calculation precision (#1408)
In some extreme cases (~30000 chars) text width precision takes a hit.
Using double instead of float fixes that.
2023-03-09 10:48:46 -05:00
Takase 1e990bdfdc
refactor(main): move SetProcessDPIAware to manifests (#1413) 2023-03-09 14:58:32 +01:00
Guldoman 73f3cd4fcd
Split `Command` struct into different structs for each command type (#1407)
This reduces the space needed for each command.
2023-03-04 15:23:09 -05:00
Takase aad52fc679
Add manifest on Windows (#1405)
* fix(gitignore): add exclusion for manifest files

* feat(windows): add application manifest

* feat(build): use application manifest on windows

* refactor(build): use genrate_file to generate the manifest

* style(manifest): remove trailing whitespace
2023-03-03 15:07:45 +01:00
Guldoman 1ec3d28ff6
Use correct view for scrolling to `find-replace:repeat-find` results (#1400) 2023-03-03 11:42:31 +01:00
Adam 2035886fcd
Added in ability to specify prefix via env variable. (#1388) 2023-02-15 21:48:09 -04:00
vqn a07a4e3706
fix incorrect x_offset if opened docs have different tab sizes (#1383) 2023-02-09 13:26:32 -04:00
Adam 8bf47ec172
Fixed up some post 5.1/jit Symbols (#1385)
* Updated k functions to have appropriate method signatures for 5.3 and up.

* Fixed up some inconsistent signatures that I forgot.
2023-02-09 12:55:47 -04:00
Guldoman 195520ea12
Make tab scrolling more flexible (#1384)
* Add `Object:{is_class_of,is_extended_by}` to check inverse relationships

* Make tab scrolling more flexible

This adds tab scrolling commands and connects them to mouse scroll
events.
This way scrolling behavior can be customized more easily.

For example an alternative behavior could be:
```lua
keymap.add({
  ["wheelup"] = "root:switch-to-hovered-previous-tab",
  ["wheeldown"] = "root:switch-to-hovered-next-tab"
})
```
2023-02-09 12:51:41 -04:00
jgmdev 02a99b17fe Correct the inverted tabs scrolling 2023-02-06 15:44:19 -04:00
Eric Gaudet a2acc6d770
Make mouse scrollwheel hovering tabs scroll the tab bar (#1314) 2023-02-06 15:40:04 -04:00
Guldoman 841a456106
Allow groups to be used in end delimiter patterns in tokenizer (#1317)
* Allow empty groups as first match in tokenizer
* Avoid pushing tokens with empty strings
* Allow groups to be used in end delimiter in tokenizer
* Use the first entry of the type table for the middle part of a subsyntax
This applies to delimited matches with a table for `type` and without a 
`syntax` field.
* Match only once if using `at_start` in tokenizer `find_text`
* Check if match is escaped in the "close" case too
Also allow continuing matching if the match was escaped.
2023-02-06 15:24:40 -04:00
Guldoman c6d269d35e
Improve `DocView:get_visible_line_range` precision (#1382) 2023-02-06 14:03:29 -04:00
Jefferson González 0495ac28a6
plugins scale: also rescale style.expanded_scrollbar_size (#1380) 2023-02-06 13:40:12 -04:00
Jefferson González d784133777
NagView: properly rescale on scale change (#1379)
* drop font option since style.font is always used
2023-02-06 13:38:00 -04:00