This reverts commit 0f1b84040d.
The new mechanism to save config.plugins upon user's configuration
reload let us stay compatible with existing plugins.
There was a double error because the config.ignore_files was
used at two differect places in different ways.
Now we apply coherently the original rule to apply
config.ignore_files to the basename of each file or directory.
We no longer use in Lite XL recursive directory monitoring as
it was a source of problems.
To enforce this at compile time we use the preprocessor to
remove the implementation of recursive monitoring for the Linux
implementation only.
It wasn't fine to call core.open_doc without filename argument
and later call Doc:save without providing both the filename and
the absolute filename. It was giving a Doc in an inconsistent
status where self.filename was set but not self.abs_filename.
Added an asset to detect early the problem if ever happens again.
In turn the problem prevented the project's module hook to work if the
file was newly created.
Simplifies and uniformize the logic on the Lua side for the
setting of directories' watches. Now we always use the methods:
systems.watch_dir_add / rm
on all the project's directories at any depth when we are not
in files limit mode.
In files limited mode the functions systems.watch_dir_add/rm are
called only on the expanded folders. The shown_subdir table is also
updated only in files limited mode.
On the C side, using the dmon library, we remove the recursive argument
from the system.watch_dir and we always call it recursively except on
Linux. At the same time the functions:
systems.watch_dir_add / rm
are provided but as dummy functions that does nothing except on Linux
where they work as before to add / remove sub-directories in the inotify
watch.
In this was on the Lua side we always act we if the watches needed to be
set for each sub-directory explicitly, independently of the system.
The important improvement introduced is that we always avoid calling
dmon_watch recursively on Linux. This latter thing is problematic with
inotify and is therefore avoided on Linux.
On the other side we simplifies the logic on the Lua side and remove
conditions based on the OS used.
The NagView takes some actual space in the Y and when it appears
it cause the documents' content to be displaced.
The movement of the documents' content is annoying and should be
avoided so we draw the NagView entirely in overlay mode using defer
draw and we always keep its y size to zero to don't affect the
other application contents.
Changes in project's module required an application restart to work.
Now the project will be re-scanned when the project's module changes.
In addition ensure borderless window config is changed when changed
in user's preferences.
It is not a good practice to keep a reference to the project's
directory object outside of the "core" module itself.
The TreeView was using such a reference in the cache item for each
file or directory entry. Replace the reference to the object with
the absolute name of the project directory.
Fix a conspicuous omission to call the dmon_unwatch function
when changing project directory.
This uncovered a bug or a quirk of the dmon library where the watch_ids
can change as a result of calling dmon_unwatch because they are just
indexes on a contiguous array. Use a workaround to always unwatch the
first valid watch_id N times.
Address issue:
https://github.com/lite-xl/lite-xl/issues/689
Attempt to provide a more accurate fix to commit:
59f64088e1
For this latter what happens is that any change inside a directory
cause the corresponding entry to be folded in the TreeView.
The new change is more accurate because we remove only the stale
entry corresponding to the delete event and we do not reset the
cache of the parent directory using the modify event.
The function "file_search" in core.init was sometimes giving a wrong index
value, off by one.
The problem happened for example when the entry to search was "less than"
the first entry, the function returned a value of two instead of one as
expected.
The bug was easily observed creating a new directory with a name that comes
as the first in alphabetical order within the project.
When `highlighter:insert_notify` was called, a hole in the array was
created.
If another call to `highlighter:insert_notify` happened before the hole
was filled, a `Position out of bounds` error could have been raised.