Commit Graph

2208 Commits

Author SHA1 Message Date
vqn 6de18442be fix cursors positions when deleting multiple selections (#1393)
* correctly handle overlapping selections merge cursors in Doc:raw_remove
2023-08-07 15:26:38 +01:00
Adam acbd8715f4 Added in explicit touchscreen keyboard support. (#1389) 2023-08-07 15:26:38 +01:00
Guldoman ca6fedd3f7 Allow `tokenizer` to pause and resume in the middle of a line (#1444) 2023-08-07 15:26:38 +01:00
Adam b30ea9e9ef 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-08-07 15:26:38 +01:00
Guldoman c1adfb55d2 Limit `core.threads` without a timeout to run 30 times per second 2023-08-07 15:26:38 +01:00
Adam Harrison c8977ca62b Made things clearer, as per jgm's suggestion. 2023-08-07 15:26:38 +01:00
Adam b348acaa81 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-08-07 15:26:38 +01:00
Guldoman d0ec3aa0fe Don't calculate widths per-uft8-char when not needed (#1409) 2023-08-07 15:26:38 +01:00
Takase ef70faa2fd 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-08-07 15:26:37 +01:00
Guldoman 71e4adbd6f Aggregate `SDL_Surface`s and their scale in `RenSurface` (#1429) 2023-08-07 15:26:06 +01:00
Guldoman e66174f9d8 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-08-07 15:26:06 +01:00
Guldoman 94e2df991c Use clipping functions provided by SDL (#1426) 2023-08-07 15:26:06 +01:00
Guldoman ca29728e34 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-08-07 15:25:46 +01:00
Takase d31f128ef9 refactor(main): move SetProcessDPIAware to manifests (#1413) 2023-08-07 15:25:46 +01:00
Guldoman 703b14170b Split `Command` struct into different structs for each command type (#1407)
This reduces the space needed for each command.
2023-08-07 15:25:30 +01:00
Takase d27bd6b14d 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-08-07 15:25:30 +01:00
Guldoman 4784a32eed Use correct view for scrolling to `find-replace:repeat-find` results (#1400) 2023-08-07 15:25:30 +01:00
Adam 9284e92291 Added in ability to specify prefix via env variable. (#1388) 2023-08-07 15:25:30 +01:00
vqn 9b45c9bdbd fix incorrect x_offset if opened docs have different tab sizes (#1383) 2023-08-07 15:25:06 +01:00
Adam 1f0cdc6831 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-08-07 15:25:06 +01:00
Guldoman cd8ec70d78 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-08-07 15:25:06 +01:00
jgmdev 1fe0796a30 Correct the inverted tabs scrolling 2023-08-07 15:25:06 +01:00
Eric Gaudet 5502f9e0a8 Make mouse scrollwheel hovering tabs scroll the tab bar (#1314) 2023-08-07 15:25:06 +01:00
Guldoman 5f24108772 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-08-07 15:25:06 +01:00
Guldoman a0c05791b1 Improve `DocView:get_visible_line_range` precision (#1382) 2023-08-07 15:02:19 +01:00
Jefferson González 0e3b5935e6 plugins scale: also rescale style.expanded_scrollbar_size (#1380) 2023-08-07 15:02:19 +01:00
Jefferson González 68108aeff2 NagView: properly rescale on scale change (#1379)
* drop font option since style.font is always used
2023-08-07 15:02:19 +01:00
Jefferson González 7f91514d6a Restore in-selection replace as discussed in #1331 (#1368) 2023-08-07 15:02:19 +01:00
Jefferson González 1fcc69d7aa Improved plugins config table handling (#1356)
* Warns user if trying to disable a plugin that is already
  enabled when doing `config.plugins.plugin_name = false` and also
  prevents replacing the current plugin config table with the false
  value to mitigate runtime issues.
* Uses a merge strategy by default when assigning a table to a plugin
  config to prevent a user from removing a plugin default config values
  as experienced and explained on this issue lite-xl-plugins#158
* This change is basically backwards compatible, but will require a
  change on the settings ui plugin on how it checks for already
  enabled plugins, since rawget will no longer be a working hack
  or workaround for this.
* As suggested by Adam dropped loaded key and switched to package.loaded
2023-08-07 15:02:19 +01:00
Guldoman c40e19d9fe Make mod-version follow semver (#1036)
* Make mod-version follow semver
  Now plugins can optionally specify the minor and patch version they
support.
  If no minor or patch version is specified, it's considered 0.
  Plugins are only loaded if they have the same major version and a
  smaller or equal minor+patch version.
* Add modversion to logging and plugin mismatch nagview

---------

Co-authored-by: Jefferson González <jgmdev@gmail.com>
2023-08-07 15:02:19 +01:00
Takase 0423611a99 fix: exec() error not returned to parent (#1363)
* fix: exec() error not returned to parent

* chore: remove accidental lua.h inclusion
2023-08-07 15:02:06 +01:00
vqn 6fc9aebae0 Context menu fixes and keyboard navigation (#1338)
* fix Doc contextmenu not registering commands if scale plugin is not found
* fix TreeView contextmenu commands not working if the mouse hovers DocView
* add keyboard navigation to TreeView contextmenu
* fix incorrect contextmenu predicate
2023-08-07 15:02:06 +01:00
Himura Kazuto 623419adfa Replace globally when replacing from selection (#1331) 2023-08-07 15:02:06 +01:00
sammyette 06cb09cb93 feat: add option to only draw whitespace if it is within selection (#1312)
* refactor: remove sort_positions usage
* refactor: move draw conditional to has_any_selection and other changes
  - snake case (sssss)
  - break after finding selection
* fix: typo of config plugins
* fix: do check for show selected only properly
* feat: only draw within selection per substitution
* `drawwhitespace`: Make `show_selected_only` work properly

---------

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
2023-08-07 15:02:06 +01:00
Adam 389449853a Abstracted open_doc out to allow for more easy overriding. (#1344) 2023-08-07 15:02:06 +01:00
Adam 1378c3d6a7 Getting rid of annoying forward slash on windows. (#1345) 2023-08-07 15:02:06 +01:00
jgmdev 8fb7a2d140 gh workflow: fix path to macOS arm64 cross file 2023-08-07 15:02:06 +01:00
Jefferson González 763d727874 ci: fix msys build now requiring ca-certificates (#1348)
Thanks to Guldoman who discovered the cause for meson failing to
validate SSL certificates which turned out to be MSYS now requiring
ca-certificates package installed for the different architectures.
2023-08-07 15:02:06 +01:00
Jan 66815b24b0 pass RenWindow by argument (#1321)
* pass RenWindow to all renderer functions that need it

* pass RenWindow to all rencache functions that need it
2023-08-07 15:02:06 +01:00
Adam Harrison 30c9c52426 Added missing header declaration. 2023-08-07 15:01:50 +01:00
Jefferson González b1e52bb9d4 plugin api: allow usage on multiple source files (#1335)
As discussed with Adam on discord current Lite XL Lua Plugin API was not
working on native plugins with more than 1 source file since imported
symbols were not exposed to other unit files. The issue was tackled on #1332
but the solution introduced another issue when Lite XL was dynamically
linked to the system lua. So we opted to tackle this by using function
wrappers around the function pointers.
2023-08-07 15:01:50 +01:00
Adam 9b0a348a91 Added in Config Postload (#1336)
* Added in an `onload` variable to configs which is called by the plugin loader.

* Used appropriate parameter.

* Fixed tabbing.
2023-08-07 15:01:50 +01:00
Guldoman 920d3ef1e3 Avoid drawing hidden text in `DocView:draw_line_text` (#1298)
* Stop drawing text past the `DocView` edge in `DocView:draw_line_text`

* Don't add draw commands if they fall outside the latest clip

The check was previously done with the window rect, so this will reduce 
a bit more the number of commands sent.
2023-08-07 15:01:50 +01:00
Jan d062c9e593 remove static libgcc from meson (#1290) 2023-08-07 15:01:50 +01:00
Adam Harrison b676314b1a Updated dummy method signature to match prototypes. 2023-08-07 15:01:50 +01:00
Guldoman 757b906ca2 Make empty groups in `regex.gmatch` return their offset (#1325)
This makes `regex.gmatch` behave like `string.gmatch`.
2023-08-07 15:01:50 +01:00
xwii 90a7882ed4 Use `table.move` to implement `common.splice` (#1324)
* Use `table.move` to implement `common.splice`

* Disallow negative `remove` in `common.splice`
2023-08-07 15:01:50 +01:00
Merlin Volkmer e52502b388 language_md: add nix code block highlighting (#1323) 2023-08-07 15:01:50 +01:00
adityaraj 9a831cb206 Create Renderer Only When It Doesn't Exist (#1315) 2023-08-07 15:01:50 +01:00
Jan 4d35dc4969 replace uses of SDL_Window with RenWindow (#1319)
Since Renwindow contains our instance of SDL_Window we can use this
to simplify future logic to create separate window instances
2023-08-07 15:01:31 +01:00