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.
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 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.
Use the function defined in the "common" module.
Move the check for not-nil filename from common.normalize_path
to core.open_doc. In this latter the filename can be nil if a
new unnamed document is created.
Move the function mkdirp into common to be generally available.
Use the new common.mkdirp from create_user_directory() from
core/init.lua replacing previous parent directory creation code
within the function.
The previous mkdirp function did not work on Windows where
absolute paths starts with a drive letter. The code from
create_user_directory() did not have this problem but was wrong
in the way it was creating the nested directories.
The new implementation in common.mkdirp fix both problems.
Groups together consecutive mouse move events like done in core.step()
lua function but on the C side.
It does not introduce any meaningful speedup but it theory is more efficient and
simplifies the Lua code.
The simplification of the Lua code alone is enough to justify this change?
* Retrieve scale plugin from lite-plugins
* New implementation of scale plugin and font C API
Introduce two new C API functions, renderer.font.get_size and set_size
respectively to get the font size and to set the size to a new value.
Using these functions we don't need to know the name of the font but
we can just change their size.
Adapt the scale plugin to use the new C API function with minor adaptations
in the logic.
Use smaller step to scale fonts.
Rename font_desc_free function, previous name was misleading as only the cached
resources are freed.
* Add contextmenu plugin from takase
From https://github.com/takase1121/lite-contextmenu
Adapted to show font scaling commands and find/replace commands.
i# testing.lua
* Fix the cursor flickering with contextmenu
To avoid flickering of the cursor when using the context menu
we add a new function `core.request_cursor` that just take note
of the cursor requested.
The cursor will be actually changed only in root_view:draw() method
only when all the drawing operations are done. This means the cursor
will be changed only once per frame and only the most recent cursor
change request will take effect.
* Remove unneeded scale plugin return functions
Use regular expressions instead of Lua patterns for find and replace editor commands.
Syntax files can now use regex or Lua patterns as before keeping backward compatibility for plugins.
In order to stay simple and closer to the lite's design principles we
deprecate the core.add_save_hook function and the related mechanism.
Instead we now directly override the Doc:save() method.
The method is already overrided from core.init to add the automatic
reloading of style when user's module is saved.
The cleanup is related to the discussion in issue #229.
When the number of files in a project directory is above the max
limit switch back to a mechanism to read directory content only
when the corresponding folder is expanded in the treeview.
When the command core:find-file is invoked the command core:open-file
is executed instead because the complete list of the project's
files is not available.
When a project search is done we search through all the files within
the project dir without indexing them.
Address issues #217#203#183.
Useful to draw whitespaces with alternate characters and colors
without slowing down the text rendering.
A new API is implemented. A renderer.replacements object can be created
to list the replacements.
In turns the function renderer.draw_text and draw_text_subpixel now accept
two optional arguments for replacements.
Since we now load the user's module before the plugins\nwe avoid to log a line for each loaded plugin to not hide\nan eventual error in the user module
The path returned by temp_filename was not writeable on UNIX (and possibly other OS). This lead to the gitstatus plugin not working.
The proposed change fixes this by using the USERDIR variable instead of EXEDIR
It make sense to not put the initial '/' in the filename as the name
is relative to the top directory it belongs to.
By removing the the initial '/' in the filename we can re-introduce the
variable
core.project_files
to stay compatible with standard Lite. The project_files variable will
always point to the files table of the first entry of
core.project_directories.
Adapted from contribute rxi/lite-plugins but changed to avoid restarting
the application when switching project.
Current problem:
- the reload of the treeview take some time without any feedback for the
user
Create the user's config init file if lite user's config directory does
not exists.
No longer use the awkward package.searchers but instead add user's
config dir at the end of package path.