* 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.
* Make command palette item scrolling more natural
Also add a config option for the maximum number of visible entries in the command palette.
* Make `autocomplete` item scrolling more natural
* Improve `autocomplete` suggestions box sizing
This avoids that the box gets too big because of non-visible items, and makes it reactive to window sizing.
* Draw ellipsis when `autocomplete` entries aren't fully visible
* comment typo in data/core/init.lua
* init.lua reword comment
* Update dirwatch.lua
Some wording is still whacky, maybe next time
* Update dirwatch.lua
* clear up can/may be not nil confusion
* falsey vs falsy new wording to help out
* falsey -> falsy
* Update data/core/dirwatch.lua
Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
---------
Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
* Improve number highlighting for python syntax highlighting
Adds support for octal and binary representation, as well uppercase characters (X, B and O)
* add underscore and negative hex/oct/bin value support
* Removed | from pattern
* fix nagbar failed save message
- visually separated statements with a `.`
- first statement slightly rewritten
- use `'` rather than `"`
* yeahhhh no back to `"`
* added text overwriting
* rewrote `DocView:draw_caret` to not use the order of draws
* forgot to delete some old code in `DocView:draw_overlay`
also added a temporary solution to overwriting
and added the missing arguments in `DocView:draw_ime_decoration`
and fixed `DocView:draw_caret`
* accidentally broke the `draw_caret` call in `draw_overlay` in the process
* multiline
* fixed calling `Doc:get_char` as a function
that, in turn, crashed the editor because "can't index a number"
* move and rename some stuff
* remove unneeded extra check
I just had to change the `~=` to `<` in the second condition
* overwrite disregards pasting text
* disregard overwrite on selections; doc only removes selection
* Fixed error where `doc` was used, instead of `self`.
---------
Co-authored-by: ThaCuber <70547062+ThaCuber@users.noreply.github.com>
Co-authored-by: Adam Harrison <adamdharrison@gmail.com>
* Avoid adding existing selections in `select_add_next`
* Use the first available selection as delimiter in `select_add_next`
* Fix returning searches with newlines in `search.find`
* Fix repeat search when the last result spanned multiple lines
* Execute at least one step when window has no focus
This way if `core.redraw` is set, it's respected.
* Fully run threads at least once when window has no focus
This allows threads that set `core.redraw` (like `projectsearch`) to
continue running even after the window loses focus.
"Fully" here means that `run_threads` has gone through *all* the "timed
out" coroutines at least once.
* Use `PATHSEP` in path-related functions
* Don't stop on digits when getting the common part in `system.path_compare`
* Avoid sorting multiple times in `dirwatch.get_directory_files`
This also fixes the timeout detection in `recurse_pred`.
When `time_to_wake` was <= 0, so when a coroutine needed to be executed
as soon as possible, we didn't check for events, so we only performed a
`core.step` with the blink timer.
This resulted in jerky reactions to input.
* Fixed issue with set_target_size passing the wrong value to plugins that are split on the right and activated from the settings UI.
* Added position awareness for the all resize_child_node calls.
* Add icons support to autocomplete plugin
* Removed redundant flag check
* Added support for non syntax colors
* Assert if color name not in style.syntax
* Autocomplete plugin improvements
* Support suggestion symbols scoping
- global: all open documents
- local: current document
- related: all open documents with same syntax
- none: language syntax symbols only
* Register style.syntax[] entries as icons
* Other related fixes