Commit Graph

205 Commits

Author SHA1 Message Date
Francesco Abbate fb1e08840e Merge branch 'dmon-1' into dmon-debug 2021-09-30 14:24:50 -07:00
Francesco Abbate f252722989 Fix error in dir_rescan_add_job 2021-09-30 14:05:48 -07:00
Francesco Abbate 4e58e8be28 Use new dmon version win watch_add/rm
Include changes in dmon not yet merged into master.
2021-09-29 14:08:05 +02:00
Francesco Abbate 2e59aaad3e Fix files limited project with dir monintoring
Changed approach to files limited project. Now we keep into the
top-level dir a list of subdirectories to be shown. When in file
limited mode we will not scan subdirectories unless they are in
the list of shown subdirectories.

With the new mechanism the function get_subdirectory_files always
recurse into subdirectories by default but is able to figure out
to stop recursing into subdirectories for files limited project.

The new mechanism is more robust of the previous one. Now the
rescan of subdirectories is compatible with files limited project.
2021-09-29 14:08:05 +02:00
Francesco Abbate 5a5fc04da4 Fix a new things about project rescan
Add a flag core.redraw to force redraw when rescan is done.

Inhibit recursion when files_limit is reached.

Still doesn't work correctly for files limited directories.
2021-09-29 14:08:05 +02:00
Francesco Abbate 264bda273d Smarter algorithm to patch files list
New algorithm use the fact that files list are always
sorted to optimize the table's insertions and removals.
2021-09-29 14:08:05 +02:00
Francesco Abbate 4cfe0c9245 Fix error in rescan list replace 2021-09-29 14:08:05 +02:00
Francesco Abbate 44cbe55baa Ensure all project files are correctly filtered 2021-09-29 14:08:05 +02:00
Francesco Abbate 9d9adccec8 Fix a few things about dmon
Ensure that we call coroutine.yield when scanning recursively.

Do not use a weak-key based on project dir when adding the job for rescan.
Since "dir" was not unique many threads were missing.

Ensure we do not block waiting for events if there are pending rescan.
2021-09-29 14:08:05 +02:00
Francesco Abbate 3af4d9fd59 Ensure directory is rescanned after the first read 2021-09-29 14:08:05 +02:00
Francesco Abbate b214471a1b Implement project files rescan on dir changes
In theory the dmon based directory monitoring is enough to ensure that
the list of project files is always correct. In reality some events
may be missing and the project files list may get disaligned with the
real list of files.

To avoid the problem we add an additional rescan to be done later in a
thread on any project subdirectory affected by an event of directory of
file change.

In the rescan found the same files already present the thread terminates.
If a difference is found the files list is modified and a new rescan is
scheduled.
2021-09-29 14:08:05 +02:00
Francesco Abbate 5f4cf6f250 Show max files warning message for initial project
If the max number of files limit is achieved when the application
is starting the StatusView is not yet configured so we cannot
show the warning.

We show the warning in the function scanning the directory only if
the StatusView is up. On the other side, when the application starts
it will check if the initial project dir hit the max files limit and
show the warning if needed.
2021-09-29 14:08:05 +02:00
Francesco Abbate aa37f2b149 Fix several problem with directory update
When scanning a subdirectory on-demand ensure files aready present
are not added twice. Files or directory can be already present due
to dir monitoring create message.

Fix check for ignore files when adding a file to respond to a dir monitor
event to use each part of the file's path.

Fix C function to compare files for treeview placement.
2021-09-29 14:08:04 +02:00
Francesco Abbate ad7bdeb129 Fix bug with expanding directory when file limited
Introduce a new field in items generated by TreeView:each_item()
to point "dir" to the toplevel directory entry.

In this was we can simplify the code and know if the toplevel
directory is files limited.
2021-09-29 14:08:04 +02:00
Francesco Abbate e01f6fefe6 Treat watch dir errors and fix various things
Verity if dmon_watch returns an error.

Add a check if an added file for which we received a create event is
ignored based on the user's config.

Add some explanatory comments in the code.
2021-09-29 14:08:04 +02:00
Francesco Abbate 7ee00c3317 Remove the project scan thread
Since the directory monitoring is now basically working we remove the
project scan thread periodically scanning the project directory.

Each project's directory is scanned only once at the beginning when
calling the function `core.add_project_directory` and is updated
incrementally when directory change events are treated.

The config variable `project_scan_rate` is removed as well as the
function `core.reschedule_project_scan`.
2021-09-29 14:08:04 +02:00
Francesco Abbate 1ba385eb5e First integration of dmon for directory monitoring 2021-09-29 14:07:34 +02:00
Francesco Abbate 590c83148e Enable inotify specific api only on linux 2021-09-29 11:38:03 +02:00
Francesco Abbate 5c4bfd9a77 Remove files from project list when collapsed
Only in limited files mode. We now symmetrically add the files if
a folder is expanded and remove them if it is collapsed.
2021-09-26 22:45:00 +02:00
Francesco Abbate c08b76746b WIP: temporary fix for testing 2021-09-21 23:50:50 +02:00
Francesco Abbate 941f135047 Fix errors with previous commit 2021-09-21 16:41:09 +02:00
Francesco Abbate 794fd6b47b Add dmon_watch_rm function to remove subdir 2021-09-21 11:39:38 +02:00
Francesco Abbate 31eed0c61a WIP: using new dmon_watch_add function 2021-09-20 17:51:46 +02:00
Francesco Abbate 04250a206a Add previous find and replace in session 2021-09-09 15:42:16 +02:00
Francesco Abbate fa8b3b33b1 Use hidden suggestions also for replace dialog 2021-09-09 15:42:16 +02:00
Francesco Abbate f85fe102d9 Implement hidden suggestions for find dialog 2021-09-09 15:42:16 +02:00
Francesco Abbate 2b277bb502 Fix problem with -psn argument on macOS 2021-09-07 06:44:15 -07:00
Francesco Abbate 90c721b823 Adopt bigger fonts by default 2021-09-07 15:11:20 +02:00
Guldoman f9c7eeeeb8 Check if session file returned anything 2021-09-07 15:03:00 +02:00
Guldoman 59aa7f0090 Fix absolute path detection in `core.project_absolute_path` 2021-09-07 15:03:00 +02:00
Guldoman d3bd35b577 Use plain `string:find` when matching plugin directories 2021-09-07 15:03:00 +02:00
takase1121 622b162225 add core.get_log() 2021-09-07 14:59:03 +02:00
Francesco Abbate 06252382ec Fix focus problem with NagView with root:close-all
Fix provided by @Guldoman in PR:

https://github.com/lite-xl/lite-xl/pull/419
2021-08-28 00:21:29 +02:00
Francesco Abbate 456f6eda65 Do not use os.exit to exit the application
Properly quit the application by terminating the core.run()
function. Otherwise a BadWindow event was happening when
closing the window.
2021-08-27 00:17:50 +02:00
Francesco Abbate dc501cb41a Fix plugin version check 2021-08-25 23:45:18 +02:00
Adam Harrison b6af395fc7 2.0 changelog and modversion updates. 2021-08-17 20:24:44 +02:00
Adam Harrison 851dc07408 Added in close others, and refactored close all. 2021-08-10 23:14:40 -04:00
Adam 47eaca18d8
Merge branch 'master' into Merged 2021-08-01 14:58:36 -04:00
Francesco Abbate 8103f21991 Only load plugins that are lua files
Before trying to load a plugin or checking its version verify if it
looks like a lua file.

Close issue #349.
2021-07-27 23:18:15 +02:00
Francesco Abbate 26873d59a3 DEBUG: more debug messages 2021-07-25 20:57:54 +02:00
Francesco Abbate 219b2a1d5c Fix files limited project with dir monintoring
Changed approach to files limited project. Now we keep into the
top-level dir a list of subdirectories to be shown. When in file
limited mode we will not scan subdirectories unless they are in
the list of shown subdirectories.

With the new mechanism the function get_subdirectory_files always
recurse into subdirectories by default but is able to figure out
to stop recursing into subdirectories for files limited project.

The new mechanism is more robust of the previous one. Now the
rescan of subdirectories is compatible with files limited project.
2021-07-25 20:49:35 +02:00
Francesco Abbate 0024f5419a DEBUG: add some rescan debug messages 2021-07-25 15:17:51 +02:00
Francesco Abbate 45a6c22b18 Fix a new things about project rescan
Add a flag core.redraw to force redraw when rescan is done.

Inhibit recursion when files_limit is reached.

Still doesn't work correctly for files limited directories.
2021-07-25 15:16:01 +02:00
Francesco Abbate eac1837a86 DEBUG: Add new debug messages for new functions 2021-07-25 00:15:40 +02:00
Francesco Abbate 95dc3d0b5f Smarter algorithm to patch files list
New algorithm use the fact that files list are always
sorted to optimize the table's insertions and removals.
2021-07-25 00:14:21 +02:00
Francesco Abbate 40cfd079d1 Ensure all project files are correctly filtered 2021-07-24 14:42:31 +02:00
Francesco Abbate 58cfee2a58 Add more debug messages 2021-07-23 23:30:24 +02:00
Francesco Abbate 4c5c126aa1 Fix error in rescan list replace 2021-07-23 23:30:06 +02:00
Francesco Abbate 52636b4acc DEBUG: Add debug support for dmon 2021-07-23 23:14:45 +02:00
Francesco Abbate 7098043e6e Fix a few things about dmon
Ensure that we call coroutine.yield when scanning recursively.

Do not use a weak-key based on project dir when adding the job for rescan.
Since "dir" was not unique many threads were missing.

Ensure we do not block waiting for events if there are pending rescan.
2021-07-23 23:04:57 +02:00