Commit Graph

1044 Commits

Author SHA1 Message Date
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
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
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 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
Himura Kazuto 623419adfa Replace globally when replacing from selection (#1331) 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
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
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
George Sokianos 9134c115fe Prepare 2.1.1r2 release 2023-05-14 11:03:41 +01:00
George Sokianos 62adafb59d Updates to make latest code compile and work under OS4 2023-01-09 00:45:37 +00:00
George Sokianos 65d95c7f40 Merge branch 'master' into amiga2.1 2023-01-08 21:04:04 +00:00
George Sokianos 0cb20ab7b2 a small fix in case the text is nil 2023-01-08 20:42:19 +00:00
sammyette 1504ad7f4c
fix: center title and version in emptyview (#1311)
* fix: divide by amount of lines
2023-01-06 15:27:05 -04:00
Guldoman 72c0ad768e
Make `dirwatch` sorting compatible with what `file_bisect` expects (#1300)
The result of `a.filename < b.filename` is sometimes different from 
`system.path_compare(a.filename, a.type, b.filename, b.type)` which 
causes issues to `file_bisect`, as it expects the sorting to be done 
with `system.path_compare`.
2023-01-05 15:59:15 -05:00
Dave 4e272c33de Minor typos in init text 2022-12-30 13:32:20 +01:00
Guldoman 74349f8e56
Fix horizontal scroll with touchpad on MacOS 2022-12-28 17:26:57 +01:00
Jefferson González 870d685b59
contextmenu: adjust y positioning if less than zero (#1268)
* use clamp for both x and y coords
2022-12-28 02:51:24 -04:00
xwii 271a804986
Fix popping subsyntaxes that end consecutively (#1246) 2022-12-27 20:24:52 -04:00
Simon Krauter 8603644726
Fix two typos in data/init.lua (#1272) 2022-12-27 19:56:30 -04:00
Martin Ashby d4989d98bd
Add example settings to _overwrite_ an existing key binding (#1270) 2022-12-27 18:40:22 -05:00
sammyette 1810db0705
fix: move tab scroll buttons to remove spacing before 1st tab (#1231)
* fix: move tab scroll buttons to remove spacing before 1st tab
* fix: always show tab scroll buttons
* fix: cleanup code, get scroll button rect for correct button
* fix: expand to full size for tabs if scroll buttons arent visible
* fix: define n as visible tabs number
2022-12-20 22:06:53 -04:00
Guldoman c42f01ed1f
Improve IME location updates (#1170)
* Avoid updating IME input rect if it hasn't changed
* Update the IME input rect even when the composition didn't change
* Apply IME input blocking workaround to non-Linux only
2022-12-20 20:11:13 -04:00
Jefferson González 3c64c32379
core: ported regex.gsub to faster native version (#1233)
* added regex.gmatch iterator and other fixes
* fixed issues reported by Guldoman
* push strings with fixed len just in case for binary safety
* added limit to regex.gsub and use pushinteger
* added description to regex.gsub limits param
* replaced substitutions regex description for correctness
* ignore negative limits on regex.gsub
2022-12-20 17:46:37 -04:00
Cyriaque Skrapits 5b5b5fd3e3
contextmenu: make divider less aggressive (#1228)
Following changes are applied:
- use divider color instead of caret;
- add a vertical padding on the divider.
2022-12-20 17:29:53 -04:00
Guldoman 9d48441685
Add `regex.find_offsets`, `regex.find`, improve `regex.match` (#1232)
`regex.match` now behaves like `string.match`.
This required changes in the `tokenizer` and in the `detectindent` 
plugin.
2022-12-11 22:25:42 -04:00
sammyette e13f265fac
feat: alert user via nagview if file cannot be saved (#1230)
* feat: alert user via nagview if file cannot be saved
it will prompt the user to choose whether they
want to save to another location and perform
the save as command
* refactor: change defer draw call to thread
* feat: log error when attempting to save doc
2022-12-11 21:38:58 -04:00
sammy dfa2f93d9c
feat: encode home in statusview file path (#1224) 2022-12-06 06:19:52 -04:00
Guldoman f7ad8753eb
Improve `regex.gsub` performance (#1220) 2022-12-02 19:21:05 -05:00
jgmdev 0373d29f99 statusview: respect right padding of item tooltip
When the tooltip was rendered on the last item of right items the right
padding was not properly getting accounted as part of the tooltip width.

This commit also fixes:

* Passing StatusView to item.get_item() instead of StatusView.item
* Some adjustments to annotations.
2022-11-24 12:34:49 -04:00
Guldoman 51f2a291d3
Make `Scrollbar` follow `force_status` when animations are disabled 2022-11-15 21:08:33 +01:00
Guldoman 519b91c2dd
Pass the currently selected item to `CommandView` validation (#1203) 2022-11-15 12:03:13 -04:00
Guldoman c6c485feb0
Use subsyntax info in `doc:toggle-{line,block}-comments` 2022-11-15 16:11:37 +01:00
Guldoman 0a1b8b6bb1
Set initial tokenizer state to a `NULL` byte 2022-11-15 16:01:04 +01:00
Guldoman e147a6cb9b
Add `tokenizer.extract_subsyntaxes` 2022-11-15 16:00:48 +01:00
jgmdev fb43e6f9e6 traceback: some lua versions do not support message as nil 2022-11-07 12:48:09 -04:00
Jefferson González 9c7304f555
highlighter: autostop co-routine when not needed (#881)
* highlighter: autostop co-routine when not needed

* applied @Guldoman suggestions
2022-11-06 03:38:10 +01:00
Jefferson González b8a4f729df
tokenizer: remove the limit of 3 subsyntaxes depth (#1186)
* tokenizer: remove the limit of 3 subsyntaxes depth

Make the state a string of bytes instead of a 32bits integer to be able
to have deeper subsyntax support. Fixes issues with syntax files like
the one for PHP that was already hitting more than 3 subsyntaxes depth.

* remove unnecesary call to set_subsyntax_pattern_idx

* fixed wrong word on comments
2022-11-03 18:56:20 -04:00