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.
When adding a directory in a project we check if the filesystem is too
slow. If it is too slow we act as if the projects was files-limited by
the number of files but we show a specific warning.
This solution is not perfect but for very low filesystem it can limit
the problem. Otherwise the application would be totally irresponsive.
Fix a problem introduced when fixing the dirty pixel problem, commit
cb08c5c. The node, when determining the layout was rounding the size
of the fixed-size view. In turns this latter was calling move_towards
to the default_size it wanted. If default_size was non-integer the
value vas never archieved because it was rounded during layout and
move_towars was keeping the editor busy by setting the
core.need_redraw flag.
The x size of the treeview plugin cannot really change expect if explicitly
resized.
The call to move_towards for x seems to raise a state where core.redraw is
always set to true and this prevent the application to go idle.
It is seen after the introduction of the dmon directory monitoring but it
is not clear why it wasn't seen before.
On windows paths belonging to network volumes will be gives like:
\\address\share-name\path
Now the code recognize these paths and treat them correctly.
Fixing the Node's clipping rectangle make the clipping in DocView:draw()
partially redundant. This latter is now no longer needed to clip
on the right when drawing the document's lines but it still serves to
the purpose of clipping on the left, before the gutter region.