Commit Graph

1098 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 66196d612c Fix in dmon.h for macOS path case sensitivity 2021-09-30 14:11:37 -07:00
Francesco Abbate f252722989 Fix error in dir_rescan_add_job 2021-09-30 14:05:48 -07:00
Francesco Abbate 991b014a5f Remove calls to reschedule_project_scan 2021-09-29 22:16:44 +02:00
Francesco Abbate 01f6767d98 Fix call to missing project_files_limit 2021-09-29 22:16:20 +02:00
Francesco Abbate 5421a1d69c remove dev note 2021-09-29 14:08:06 +02:00
Francesco Abbate 201dd295f9 Use PLATFORM to detect macOS for key bindings 2021-09-29 14:08:05 +02: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 e8b9d2c44a Add missing pthread dependency 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 494587954f More accurate path compare function 2021-09-29 14:08:05 +02:00
Francesco Abbate e57d63e3a3 Update dmon from septag/dmon commit 74bbd93b
The new version includes fixes from jgmdev, github PR:

https://github.com/septag/dmon/pull/11

to solve incorrect behavior on linux not reporting directory creation.

Includes also a further revision from septag.
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 0d1bec8e35 Remove the treeview check for modified files
In the treeview the implementation was checking the files list
to detect if it changed because of a project scan. Since we removed
the project scan we no longer need the check.

Removed the TreeView's self.last table that stores previous files
object by top-level directories.
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 09d2c0a325 Update dmon from septag/dmon with fix for linux
Update from https://github.com/septag/dmon, commit: 48234fc2 to
include a fix for linux.
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 c05cddecb7 Use PLATFORM to detect macOS for key bindings 2021-09-29 11:38:55 +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 958703de02 Fix abort when dmon_watch_rm remove a wd 2021-09-26 22:43:13 +02:00
Francesco Abbate 9198e48fec Bring back the dmon_watch_rm function 2021-09-26 22:41:07 +02:00
Francesco Abbate ff86d54ff5 Move to dmon.h new version to test
By doing so we removed the addition of dmon_watch_rm and
the Lua code will no longer compile.
2021-09-26 22:37:57 +02:00
Francesco Abbate c08b76746b WIP: temporary fix for testing 2021-09-21 23:50:50 +02:00
Francesco Abbate 7a4cc8ece9 Add missing pthread dependency 2021-09-21 16:41:27 +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 93cf01adfc WIP: add some notes about dmon_watch_add 2021-09-20 17:53:58 +02:00
Francesco Abbate 31eed0c61a WIP: using new dmon_watch_add function 2021-09-20 17:51:46 +02:00
Francesco Abbate 3fa8866532 Adding new dmon version with dmon_watch_add 2021-09-20 17:18:03 +02:00
Francesco Abbate 18189e63b6 Fix repackage script to restore project version 2021-09-10 15:48:43 +02:00
Francesco Abbate 8dd530e5cf Add -branch option in repackage script 2021-09-10 15:47:33 +02:00
Francesco Abbate 218999dff8 Avoid bug when replacement stop at end of string
Detect when we are past the end of the string to avoid by
checking if byte is not nil.

Fix #510.
2021-09-10 14:55:04 +02:00
Francesco Abbate afd0672197 Use line/col to identify selection in replace command 2021-09-10 14:54:55 +02:00
Francesco Abbate cec1e4efb9 Do not fail search if there was an option change 2021-09-09 23:30:18 +02:00
Francesco Abbate 83607aec4a Reword changelog 2021-09-09 22:37:26 +02:00
Francesco Abbate d9afc40a17 Bring back command find-replace:select-next
Bring back the command like before to keep single selection but with
ctrl+f3 keybindings. Change the name of the new multi-cursor command
but keep the ctrl+d keybinding.
2021-09-09 21:40:41 +02:00
Guldoman aa0e083cb9 Allow `find-replace:select-next` to select more occurrences after wrap
The initial position for the search is defined by the last selection 
towards the end of the file.
After reaching the end of the file, it would always select the same 
selection to start the search from.

Now, we start the search from each selection, until a new occurrence is 
found.
2021-09-09 21:38:12 +02:00
Francesco Abbate 04250a206a Add previous find and replace in session 2021-09-09 15:42:16 +02:00
Francesco Abbate 403b7f6fb6 Add missing remove tooltip call 2021-09-09 15:42:16 +02:00