Commit Graph

81 Commits

Author SHA1 Message Date
jgmdev 48e86bb117 plugin treeview: skip rootview events if not visible. 2022-03-07 16:52:32 -04:00
Adam f85612e0f0
Fix Project Scanning (#746)
Removed dmon, and replaced with logic that works across Linux, Mac, FreeBSD and Windows. Have tested on all platforms, and seems to work.

Co-authored-by: Jan200101 <sentrycraft123@gmail.com>
2022-03-06 00:59:22 -05:00
Francesco Abbate f6a0e12e31 Merge branch 'master-2.0' 2022-01-19 20:31:33 +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 143b389365 Clear TreeView cache when closing project 2022-01-07 10:41:18 +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 9155be7a22
Ensure TreeView cache entry is removed on delete
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.
2021-12-22 23:40:54 +01:00
Guldoman 9e7bdf49e9
Revert "Merge pull request #697 from Guldoman/treeview_remove_changed"
This reverts commit 4e078cc217, reversing
changes made to 0c488c9492.
2021-12-22 23:39:26 +01:00
Francesco Abbate 37c00c877a Ensure TreeView cache entry is removed on delete
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.
2021-12-20 11:03:49 +01:00
Adam 997b3efbb7
Merge pull request #708 from Guldoman/treeview_styling
Allow `TreeView` item icon and text styling
2021-12-12 12:04:59 -05:00
Adam Harrison 7b55470159 Fixed treeview clicking not being caught. 2021-12-11 17:51:19 -05:00
Guldoman c16d6b3d8d
Avoid drawing hidden `TreeView` items 2021-12-07 21:45:20 +01:00
Guldoman fdb29f28cf
Split `TreeView:draw` into multiple functions
This allows plugins to override each aspect of TreeView item drawing.
2021-12-07 21:44:20 +01:00
Guldoman d7afcb08b1
Check the entire path in `TreeView` `new-file` and `new-folder` commands 2021-11-30 01:11:35 +01:00
Guldoman e500368ce4
Allow `TreeView` item icon and text styling 2021-11-29 23:36:49 +01:00
Guldoman ef4c02ab0e
Check the entire path in `TreeView` predicate 2021-11-28 07:16:53 +01:00
Guldoman 59f64088e1
Remove changed files/dirs from `TreeView` cache 2021-11-24 06:16:54 +01:00
Adam Harrison 96db380c73 Manual merge of into . 2021-11-23 15:57:22 -05:00
Joshua Minor 373007a767 Switched to TreeView:color_for_item(abs_path) 2021-11-21 15:24:45 -08:00
Joshua Minor bede0ff878 Allow for color overrides in the tree view 2021-11-21 00:24:24 -08:00
Guldoman f99afcd29c
In `TreeView` set correct active `View` before opening new `DocView`
Before this, the new `DocView` was always added to the primary `Node`.
With this, it gets added to the last focused `Node`.
2021-11-07 23:12:03 +01:00
Francesco Abbate 167e41de65 Fix problem with treeview keeping the editor busy
Fix a problem introduced when fixing the dirty pixel problem, commit
cb08c5c. The node, when determining the layout was rounding the size
of the fixed-size view. In turns this latter was calling move_towards
to the default_size it wanted. If default_size was non-integer the
value vas never archieved because it was rounded during layout and
move_towars was keeping the editor busy by setting the
core.need_redraw flag.
2021-10-21 23:18:31 +02:00
Francesco Abbate 43374b036f Fix problem with treeview x resizing
The x size of the treeview plugin cannot really change expect if explicitly
resized.

The call to move_towards for x seems to raise a state where core.redraw is
always set to true and this prevent the application to go idle.

It is seen after the introduction of the dmon directory monitoring but it
is not clear why it wasn't seen before.
2021-10-21 23:18:31 +02:00
Francesco Abbate 9c43727ebc Implement directory monitoring using septag/dmon
Use a notification based directory monitoring based on the
septag/dmon lirbary instead of periodically rescan the whole
project's tree.
2021-10-08 21:31:22 +02:00
Francesco Abbate 34983668d8 Normalize to project dir in treeview open
When left-clicking in a TreeView file we use now
core.normalize_to_project_dir to normalize correctly
the file name.
2021-10-02 18:37:01 +02:00
Guldoman e2f7c984de Reset syntax highlighting on file rename 2021-10-02 18:37:00 +02:00
Francesco Abbate 14dd6f1cd6 Normalize to project dir in treeview open
When left-clicking in a TreeView file we use now
core.normalize_to_project_dir to normalize correctly
the file name.
2021-09-19 23:52:18 +02:00
Guldoman 80a6b2245e
Reset syntax highlighting on file rename 2021-09-17 23:41:14 +02:00
Guldoman 474952645c Fix `treeview:open-in-system` command on Windows
The first argument is the title for the `CMD` window.
2021-09-07 22:33:48 +02:00
Guldoman f18629ab64 Avoid exposing `treeview` commands when not usable 2021-09-02 23:19:40 +02:00
Guldoman 167cda23f6 Make open files follow renames 2021-09-02 23:19:40 +02:00
Adam Harrison b6af395fc7 2.0 changelog and modversion updates. 2021-08-17 20:24:44 +02:00
Adam Harrison e539310e6d Namespace plugin-specific configuration settings. 2021-07-15 17:58:14 -04:00
jgmdev afa0c175e8 Added delete confirmation using NagView. 2021-07-12 11:41:31 -04:00
jgmdev a4d5622eda Make use of core.reschedule_project_scan() 2021-07-11 23:03:33 -04:00
jgmdev 68459a9199 Added context menu to treeview. 2021-06-28 11:11:49 -04:00
Francesco Abbate 1ad4289e76 Do not try to update topdir folder in treeview
If the directory expanded is a project's top directory
do not attempt to update its content.

Fix again issue #275
2021-06-17 19:07:32 +02:00
Francesco Abbate 4c9083398a Fix error in dirname computation in TreeView
In TreeView:on_mouse_pressed() we need to find the directory a
relative filename belongs to from its absolute filename.
The code was using string.find to locate the relative filename
within the absolute path but in some very specific cases we can
find a pattern which is not the right-most one leading to a
wrong directory name.

Fix the error by adding a loop to make sure we find the right-most
match. The standard Lua library has not a string.rfind to make a
reverse search.

Close #275
2021-06-17 18:23:30 +02:00
Francesco Abbate 10fde6e264 Implement lazy loading of directories
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.
2021-05-26 14:22:10 +02:00
Francesco Abbate 5cef643e02 Introduce new plugin versioning tag mod-version
New plugins should use the version tag:

-- mod-version: 1

The old version tag "-- lite-xl 1.16" will be considerer equivalent
to mod-version 1.
2021-05-05 22:38:29 +02:00
Francesco Abbate d7cc1f9f9d Add plugin verification by version tag 2021-04-06 17:50:46 +02:00
takase1121 5e8444b2b1 rename tooltip_alpha_step to tooltip_alpha_rate 2021-03-20 01:04:07 +00:00
takase1121 93753634f5 set delay to 0.5 and disable animation 2021-03-20 01:03:16 +00:00
takase1121 cdf5b9b9b8 show tooltips only when hovering over text 2021-03-20 00:57:06 +00:00
takase1121 d191e8ee34 prevent rendering tooltip when alpha is 0 2021-03-20 00:28:49 +00:00
Takase 0bb7f21dd7
tooltip enhancements (#114)
Add a delay to show the tooltip and other improvements.
2021-03-18 16:18:36 +01:00
takase1121 1f97805321 normalize tooltip filename to home dir 2021-03-14 03:09:18 +00:00
Takase 13ebb51c38
add tooltips to treeview.lua (#100) 2021-03-13 16:44:40 +01:00
Francesco Abbate 5bf7abf23d Ensure filename are store relative to project directory 2021-03-06 23:36:05 +01:00
Francesco Abbate 4d320c1946 Ensure treeview is large enough to show toolbar 2021-02-27 19:39:56 +01:00