Commit Graph

1639 Commits

Author SHA1 Message Date
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
Adam Harrison 31d448971a Restored floating point time granularity. 2022-01-08 12:59:15 -05:00
Adam 93076bdc41
Merge pull request #781 from Jan200101/PR/lua54
Migrate to Lua 5.4
2022-01-08 12:11:48 -05:00
takase1121 fc809b3172
comment the entire line when using block comment 2022-01-08 18:45:38 +08:00
Francesco Abbate 143b389365 Clear TreeView cache when closing project 2022-01-07 10:41:18 +01:00
takase1121 087314aea4
fix lhelper script 2022-01-07 17:31:24 +08: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
takase1121 df0f6fb94c
make set_selections consistent 2022-01-02 19:18:08 +08:00
takase1121 e079ddfa37
refactor toggle-block-comments, make command spaces aware, set selections correctly 2022-01-02 19:14:03 +08:00
Adam 067e7cc6cd
Merge pull request #784 from Jan200101/PR/label-update
add Libraries label
2022-01-01 12:18:41 -05:00
Jan200101 73a867fc89
add Libraries label 2021-12-31 13:53:31 +01:00
Jan200101 99ddf1fb92
Migrate to Lua 5.4 2021-12-31 13:53:01 +01:00
Adam 186248911a
Merge pull request #782 from Nightwing13/patch-2
[Fix] Pointer Bug in ToolBar plugin
2021-12-30 19:25:03 -05: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
Nightwing 60322a93a8
Update toolbarview.lua 2021-12-30 11:12:24 +09:00
Nightwing 46aaf57b45
[Fix] Pointer Bug in ToolBar plugin
Fixes an issue where the pointer moves down when "open user module" button is spammed
2021-12-30 06:26:58 +09:00
Adam 1552f18a87
Merge pull request #753 from Jipok/highlight_selection
Add for config.highlight_current_line new variant: no_selection
2021-12-29 14:43:17 -05:00
Adam 416a06c566
Merge pull request #765 from Guldoman/treeview_remove_deleted
Better "Remove changed files/dirs from `TreeView` cache"
2021-12-29 12:41:36 -05:00
Adam 3696937fec
Merge pull request #769 from takase1121/font_gc
fix FontGroup __gc method
2021-12-29 12:18:28 -05:00
Adam d2e02bbed3
Merge pull request #778 from eli-schwartz/meson
Meson: retain compatibility for very old versions
2021-12-29 12:13:59 -05:00
Francesco Abbate 88ed312f6b Fix NagView missing mouse events 2021-12-29 16:00:53 +01:00
Eli Schwartz 7a961c8c8e
meson: lower the minimum buildsystem requirements even more
Only a couple trivial features from meson ~0.50 were being used, and
none of them are really needed:

- configure_file() with the install kwarg has always defaulted to
  inferring its value from whether an install_dir was defined. This is
  fine, we don't need to set `install: true` in that case. The kwarg was
  only even added to meson 0.50 for consistency and to allow
  conditionally overriding the file to not install, even when
  install_dir is set. This project does not need that feature.

- path building could historically be done with the join_paths()
  function. Recent versions of meson (0.49) added cosmetic sugar in the
  form of string operator overloading to allow using the division
  operator on two strings. By removing this and using the backwards
  compatible form, we can support older versions of meson.

- sdl2 dependency lookup with hardcoded config-tool method is very
  opinionated about the correct way to look up sdl2, but meson can try
  multiple methods if you permit it, and there is no reason to think
  that config-tool is the only one that returns correct results.

By removing these features, the minimum can be dropped all the way down
to a version that is available on the oldest supported versions of
Ubuntu (18.04), Debian (oldoldstable / Stretch) and anywhere else of
consequence.
2021-12-28 17:50:10 -05:00
Eli Schwartz fcb3c41082
meson: lower the minimum buildsystem requirements
No features of 0.54 are being used, so 0.50 should be perfectly fine.

This drops the minimum requirement down to a version available in the
latest Ubuntu LTS (20.04), which only has 0.53
2021-12-28 17:19:16 -05: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
Adam 1e6046e499
Merge pull request #763 from Jipok/portable_try
Support portable user config(Fix #762)
2021-12-26 16:59:13 -05:00
takase1121 33f7fe4fda
toggle comment for whole line if nothing is selected 2021-12-26 15:12:28 +08:00