Commit Graph

1257 Commits

Author SHA1 Message Date
George Sokianos 893fbfc43f Extra changes to make it compile under OS4 2022-03-27 22:11:26 +01:00
George Sokianos f363c34499 Applied all the necessary changes to make it run under AmigaOS 4.1 FE 2022-03-27 21:17:48 +01:00
Francesco Abbate 39f4ebe210 Include addons with build-package for bundles 2022-01-29 05:16:51 -08:00
Francesco Abbate 86f2cefde8 Fix again bug with invalid ignore_files patterns
The pattern cannot be tested in advance as it seems that Lua inspect
the pattern only partially, the part that is actually used.

We resort to use pcall to catch any error when using the pattern.
2022-01-27 08:42:54 +01:00
Francesco Abbate 10d4f0a53a Add a small top margin when drawing tabs
Using style.divider_size for the top margin size.
2022-01-26 16:57:26 +01:00
Francesco Abbate 96b7e68c67 Do no error out on malformed ignore patterns 2022-01-25 14:14:56 +01:00
Francesco Abbate de1db14d4a Add gruvbox light and dark theme
Created based on the gruvbox color theme:

https://github.com/morhetz/gruvbox
2022-01-25 13:58:42 +01:00
Francesco Abbate c9d4f6fab3 Fix problem with project module save hook 2022-01-24 09:31:40 +01:00
Francesco Abbate d1017895eb Use new mutex in dmon to avoid possible lock-up
We rely on one variable _dmon.modify_watches shared between thread to
ensure that we don't lock with the dmon polling thread waiting indefinitely
and helding a lock.

To ensure that the polling thread sees modifications done to 'modify_watches'
we use an additional mutex that act as a memory barrier.
2022-01-24 09:14:59 +01:00
Francesco Abbate cd83df1abf Bump version and changelog to prepare 2.0.5 release 2022-01-19 18:18:25 +01:00
Francesco Abbate 2dd154edeb Remove remaining debug message 2022-01-18 10:42:20 +01:00
Francesco Abbate 7e9b2f30da Treat final '/' or '/$' in ignore rule as part of the pattern
Evolve the rule for directory in ignore_files to be more natural
and easy to understand.

When a final '/' or '/$' is found we consider the pattern to match
a directory and the pattern is not modifed. In turns, is used, before
matching a directory's name a final '/' is appended to its name
before checking if it matches the pattern.

With the previous rule a final '/' in the pattern meant also a directory
but the '/' was removed from the pattern.
2022-01-13 16:43:37 +01:00
Francesco Abbate 2456452f65 Fix error to close view when deleting a file 2022-01-13 16:38:20 +01:00
Francesco Abbate ae1890d29a Fix project files reading with symlink 2022-01-12 00:32:10 +01:00
Francesco Abbate 4cdd42de1a Ensure config.plugins are restored on new config
When a user's or project's module configuration file is changed we
make sure that the config.plugins fields are all restored so that
all plugins already loaded can continue to work.
2022-01-10 09:54:47 +01:00
Francesco Abbate 656a89c494 Fix checks when opening new project directory 2022-01-09 23:26:11 +01:00
Francesco Abbate 827f3f876d Remove remaining debug code fragment 2022-01-09 23:26:11 +01:00
Francesco Abbate 648b977c1e Use a timeout in dmon thread with pending events 2022-01-09 23:26:11 +01:00
Francesco Abbate 9be22f0b8d Attempt to fix dmon critical section for windows
Should fix commit bb12f085f3.

When taking the critical section we should always send the
event to wakeup the events thread. In addition use
TryEnterCriticalSection to send the event only if needed
reducing the number of spurious events sent.
2022-01-09 23:26:11 +01:00
Francesco Abbate 19ec86d971 Do not use timeout in dmon linux select
Wait indefinitely in select and wake-up the thread when needed.
2022-01-09 23:26:11 +01:00
Francesco Abbate 44a8dc320b Fix some errors with previous commits 2022-01-09 23:26:11 +01:00
Francesco Abbate 6584bdfd33 On Windows wait indefinitely in dmon thread
Avoid waiting with a finite timeout and wait indefinitely in
dmon thread. When we need to unwatch we send a signal to a special
event meant to wakeup the waiting thread.
2022-01-09 23:26:11 +01:00
Francesco Abbate f0aea5b1a4 Report error codes from dmon_watch_add 2022-01-09 23:26:11 +01:00
Francesco Abbate 39366d3a09 Ensure project rescan thread is terminated
When changing a project we need to ensure that the old threads
are no longer run.
2022-01-09 23:26:11 +01:00
Francesco Abbate 1520c12580 Remove DMON_LOG_ERROR to return an error code 2022-01-09 23:26:11 +01:00
Francesco Abbate 7473fbf32c Fix undue asserts in dmon_extra
Some asserts are placed in case that can effectively occur
so we remove the assertion and we return false. In turn we
adapt the logic accordingly so when false is returned to add
a watch we do not open that directory.
2022-01-09 23:26:11 +01:00
Francesco Abbate 5032e7352e Write an initial project module if not present 2022-01-09 23:26:11 +01:00
Francesco Abbate a703840068 Add some comments for ignore_files logic 2022-01-09 23:26:11 +01:00
Francesco Abbate 295c65da92 Use compiled ignore_files pattern
Try to digest the ignore_files pattern before potentially processing
a lot of files because it may be expensive.
2022-01-09 23:26:11 +01:00
Francesco Abbate 5b154c189f First version of paths in ignore_files
Works correctly and the logic seems sound even if somewhat quirky.

`^%.` match any file of directory whose basename begins with a dot.

`^/node_modules$/"` match a directory named `node_modules` at the project's root.

  Note that the final '/' needs to be at the end. The '/' after the '^' needs to be there to trigger
  a match of the full path filename so we are sure it is at the root.

  PROBLEM: the '/' to trigger full path match could be in a pattern's special expression like:
  [^/]

`^%.git$/` match any directory name '.git' anywhere in the project.

`^/%.git$/` match a directory named '.git' only at the project's root.

`^/subprojects/.+/` match any directory in a top-level folder named "subprojects".

`^/build/` match any top level directory whose name begins with "build"

  PROBLEM: may be surprising, one may expects it matches only a directory named 'build'. It actually acts like
  it was `^/build.*/`.
2022-01-09 23:20:47 +01:00
Francesco Abbate 143b389365 Clear TreeView cache when closing project 2022-01-07 10:41:18 +01:00
Francesco Abbate 7ded5c8199 Fix problem when reloading project directory 2022-01-06 18:00:48 +01:00
Francesco Abbate 1e7075ca9f Do not force choosing project dir to suggestion
When changing or opening a project directory do not
take the selected item from suggestion but simply the
entered text as it is.

Otherwise the user may be unable to choose a directory
if the text matches the beginning of suggestion.

Close #791
2022-01-05 23:42:47 +01:00
Francesco Abbate 1b57107352 Fix problem with special file types
For special file types like the ones in /dev/ the info
entry's type is neither file neither dir.

We prevent these kind of files from being listed in the
project.
2022-01-05 23:32:26 +01:00
Francesco Abbate 9929ca9c2d Fix logic with project directories suggestions
Attempt to fix issue #791.

The logic set with the previous commit for suggest_directory
is similar to the one we use except the previous expression
was false do to operator precedence for "and" versus "or".

With the modification here, when opening a project directory,
we suggest the recently used projects
if the text is equal to dirname(project_dir) + "/" which
happens to be the text the command view is initially set to.
In addition we do the same if text is "". If the condition is
not met we return the suggestions from common.dir_path_suggest to
match the text entered.

Works well on Linux but may not solve the problem on Windows, it
should be tested.
2022-01-05 23:21:47 +01:00
Francesco Abbate f3cf7ac9c7 Do not reload core.keymap module
Avoid reloading the core.keymap module when user's config
or project module change.

The reason is the plugins like autocomplete can add keymaps
and the additions from plugins would be lost.

Close issue #793
2022-01-04 18:06:30 +01:00
Francesco Abbate bf578d5ee4 Fix logic for file create event
When we get a file or directory creation event we need to
ensure that all the parent directories pass the ignore_files
test.
2022-01-03 18:55:01 +01:00
Francesco Abbate 445c79bb52 Revert "No longer store autocomplete options in config"
This reverts commit 0f1b84040d.

The new mechanism to save config.plugins upon user's configuration
reload let us stay compatible with existing plugins.
2021-12-31 00:22:49 +01:00
Francesco Abbate 03350cc14b Restore config.plugins when reloading config
Some plugins store options in:

config.plugins.<plugin-name>

so we restore all the kay-values of config.plugins when
reloading the user preferences.
2021-12-31 00:20:52 +01:00
Francesco Abbate 85d26adb62 Fix project's module loading when changing project
Fix a bag of subtle problem about when loading the
project module.

We need to load the project's module before to scan
the project directory.
2021-12-30 23:57:23 +01:00
Francesco Abbate 68aea88510 Fix error with ignore_files
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.
2021-12-30 22:24:43 +01:00
Francesco Abbate 9578359b2b Remove inotify recursive directory monitoring
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.
2021-12-30 15:45:09 +01:00
Francesco Abbate fd074ff39a Fix problem when opening project's module document
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.
2021-12-30 15:26:40 +01:00
Francesco Abbate adaf023541 Always watch/unwatch subdirectories on all systems
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.
2021-12-30 15:25:27 +01:00
Francesco Abbate 88ed312f6b Fix NagView missing mouse events 2021-12-29 16:00:53 +01:00
Francesco Abbate 8550049db8 Draw NagView in overlay mode
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.
2021-12-28 16:43:27 +01:00
Francesco Abbate 2cf3c6f747 Ensure project reload when changing project module
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.
2021-12-28 14:36:21 +01:00
Francesco Abbate 05b003eeb5 Avoid references to project's dir in TreeView
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.
2021-12-28 14:36:21 +01:00
Francesco Abbate 0f1b84040d No longer store autocomplete options in config
Plugins should not store private stuff in core.config because this
latter can be reloaded due to user changing preferences.
2021-12-28 12:25:48 +01:00
Francesco Abbate 1f0785b73f Scan project folder after project module is loaded
Otherwise the initial scan of the project folder is done without
taking into account the config.ignore_files directives.
2021-12-28 10:59:01 +01:00