This is needed because users could try to enable plugins with
`config.plugins.plugin_name = true`.
Before, this would result in `common.merge` throwing an error; now it
just returns a copy of the "base" table.
Since the linewrapping plugin modifies some of the DocView line
calculation and positioning functions we need to make sure of loading it
before other plugins. This way we make sure that plugins that also overwrite
and depend on DocView functionality aren't using the original methods without
the linewrapping changes, which leads to wrong line and column calculations.
The number of results from a pattern with groups must never be greater
than the number of token types for that pattern.
Also if a token type was undefined, it's now pushed as a `normal` one.
Before, this was only supported by Lua patterns.
This expects the regex to use the same syntax used for patterns. That
is, the token should be split by empty groups.
* Modified autoreload to use new dirwatch infrastructure, and added in nagview to verify that fs changes don't stomp on our changes, unless you want them to.
* Split out reload functionality to actual document, and added in a thread to check the document, in the cases where it wouldn't be covered by dirwatch.
* As per request from jgmdev, added in ability to show nagview always.
* Changed things over to use dirwatch.
* Made sure we redrew things, added in a contingency in 'save' for times when we load a non-existent file, and added some checks.
* Prevent adding duplicate bindings
* Clean reverse_map on overwrite or add direct
* Added get_bindings to complement get_binding
* Added doc comments for easier comprehension
* Check if command is function on add_direct
Currently some plugins had/have issues with predicates that check
if active view is a docview to perform certain operations like draw
in the case of minimap or lineguide. Since is() was checking the
entire inheritance tree it was returning true for views that inherit
from the same parent, which caused CommandView to be matched along
DocView, etc... This change does the following to solve the issue:
* Make Object:is() only match the top level parent of the object which
is more in line with what one would expect from a method named 'is'.
* Introduces Object:extends() which keeps the same functionality that
Object:is() offered before.
* Change to 1 click as per RFC on discord, with 100% in favour.
* Added in the ability to specify as a view name, so it doesn't modify the title, and also fixed a bug where if you clicked *over* the amount of times your config says, it wouldn't regsiter.
* Changed plugin to use keymap.
Using `get_active_node` might result in a locked `Node`; calling
`add_view` on that `Node` throws an error.
`get_active_node_default` always returns an unlocked `Node`.
* Send `mouseleft` event when the mouse leaves the window
* Call `View:on_mouse_left` when the mouse leaves the `View`
Previously `View:on_mouse_left` was called only when the mouse left the
window, and it was called on every visible `View`.
Now it gets also called when the mouse "changes" `View`, and only the
last `View` the mouse was on will receive the event.
Before the addition of multi-cursor support, we just returned the second
return value of the "replacer" function to the caller.
With the introduction of multi-cursors, we naively summed the second
return values for each cursor.
In some cases the "replacer" function doesn't return any second value,
so we tried to do math with `nil`, thus throwing errors.
Now the second return value is added to a table which is then returned
to the caller.
* Change to 1 click as per RFC on discord, with 100% in favour.
* Added in the ability to specify as a view name, so it doesn't modify the title, and also fixed a bug where if you clicked *over* the amount of times your config says, it wouldn't regsiter.
* Changed plugin to use keymap.
This allows `keymap.add` to map shortcuts to functions.
If the function returns `false`, the next command is executed (as if the
`predicate` of a `command` failed).
Add configuration options to specify:
- characters to substitute and their substitution;
- whether to substitute at the beginning, middle or end of the line;
- the color of the substitution;
- the color for the beginning, middle or end;
- the minimum number of white space to show in the middle.
* Introduces a flag that syntax writers can turn off named
space_handling, turning it off means that your syntax will take care
of handling the excessive amount of spaces that can slow down the
tokenizer.
* Adds another pattern at the end of every single table that also
improves tokenizer performance by matching words that weren't match by
any of the synxtax patterns.
* Modifies language_md to turn off the provided space_handling and do its
own since it has rules that require a space at the beginning, also
handles long consecutives amount of dashes used in tables that degrade
performance.
* This changes where discussed in collaboration with @Guldoman and
@takase1121 thanks to all!
* support colorization of function and variables type declarations
* support the macro concatenation operator ##
* support what seems to be new cpp number notation format #'###
* improved uppercase constants matching
* fix delete_temp_files() deleting in EXEDIR but temp_filename() was
creating temp files in USERDIR
* make delete_temp_files() public so it can be used by plugins
* add optional `dir` parameter to both delete_temp_files() and
temp_filename() to allow specifying a different directory, this is
for example useful when generting markdown previews, the temp file
should be generated in the project dir in case the readme references
images that are relative to it, so the web browser can find them.
* mainly the language_md got affected which has some exotic rules
* some other languages are also using spaces at start of pattern
and even if not affected this change tackles that
When using `doc:move-to-{previous,next}-char` in a selection, we were
moving the cursor to the character before the initial/after the last
character of the selection.
Now we follow what other editors do and move it to just before the
initial/just after the final character.
* Improved performance 67x by not using the tokenizer, this means that
now opening files or saving them where indentation is re-detected
is much more faster.
* Improved the algorithm to detect the space size.
* Do not compete with language_cpp.lua over the .h and .inl files,
these files can contain both cpp and c so we choose the former which
supports both syntaxes.
* Added support for magic and uppercase constants.
* Removed pcall(require, "plugins.language_c") since it doesn't works
as it seems to have been intended.
* Removed duplicate keywords
* Added support for magic and uppercase constants.
* Basically merged most changes from the lite-xl-plugins repo.
This new config flag ignores the plugins version check at startup
which helps a lot when working on new or old plugins that doesn't match
the mod or lite-xl version and you still desire to load them to fix them
by checking with lite-xl it self which errors need to be corrected.
Also some other minor changes:
* fix transition when nagview is closed
* do not draw or update when not visible
* do not process events when not visible
* cleaned a bit the logic on next and show
* fixes#848
When a user modifies and saves the init.lua or a project module file the
reload_customizations() function was performing unnecessary reloading
of core.config and core.style. This resulted on the replacement of config
tables with new tables, breaking all active references been used by
the consumers of this config options. Been redundant this means
that every consumer was using its own copy of a configuration table
different from the one referenced on core.config and user changes not
taking place.
* Fixed some issues with inotify and multiple events at the same time. Seems to be working now.
* Cleaned up and simplified function, and commented, and fixed a number of bugs.
* Simplifying and fixing further.
* Improved performance for skipping large amounts of files.
* Added in extra checks, and changed paths. We should probably unify these path styles.
* Fixed stutter.
* Removed extraneous functions.
* Cleaned up more, added more testing; dealt with multiple sequential events correctly.
Removed dmon, and replaced with logic that works across Linux, Mac, FreeBSD and Windows. Have tested on all platforms, and seems to work.
Co-authored-by: Jan200101 <sentrycraft123@gmail.com>
Before, syntax patterns/regexes that started with `^` didn't have the
desired effect of matching with the start of the line.
Now those patterns are used only when matching the whole line.
* Items are now objects that can be retrieved and manipulated.
* clip rect is used for left and right panes
* initial support for items to do their own custom drawing by also
doing a clip rect for them
* a custom background color can be specified for the item.
* a command or function can be executed on item click.
* Introduced functionality to easily hide or show all or specific items.
* Better handling of deprecated get_items()
* Spacing is automatically added to items and cleaned on deprecated
items.
* Default items where separated and given the names:
doc:file, doc:position, doc:indentation, doc:lines,
doc:line-ending, core.commandview.
* Some default right or left click actions where given to the default
items.
* Started adding required bits to support dragging to left and right
panes when some items aren't visible.
Note: should work well enough already but maybe some repetitive stuff can be
cleaned out.
* Support for predicates by introducing add_item().
* Support for performing click actions on items.
* Support for optional tooltips on item hover.
* Deprecate the usage of get_item().
* Fixed rendering computations for y offset.
* Force monospacing if every ascii character has the same integer advance.
* Added in explanatory comment.
* Fixed issues.
* Made lines less long.
The pattern cannot be tested in advance as it seems that Lua inspect
the pattern only partially, the part that is actually used.
We resort to use pcall to catch any error when using the pattern.
This is needed for example when a selection has both `line1` and `col1`
at 1, and the left arrow is pressed: `line2` and `col2` change, while
`line1` and `col1` don't, but we still want to scroll.