Commit Graph

447 Commits

Author SHA1 Message Date
sammyette 06cb09cb93 feat: add option to only draw whitespace if it is within selection (#1312)
* refactor: remove sort_positions usage
* refactor: move draw conditional to has_any_selection and other changes
  - snake case (sssss)
  - break after finding selection
* fix: typo of config plugins
* fix: do check for show selected only properly
* feat: only draw within selection per substitution
* `drawwhitespace`: Make `show_selected_only` work properly

---------

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
2023-08-07 15:02:06 +01:00
Adam 389449853a Abstracted open_doc out to allow for more easy overriding. (#1344) 2023-08-07 15:02:06 +01:00
Merlin Volkmer e52502b388 language_md: add nix code block highlighting (#1323) 2023-08-07 15:01:50 +01:00
Guldoman 16bfa6d958 Use proper timeouts for coroutines that don't need to wait (#1467) 2023-08-07 14:51:14 +01:00
Guldoman 862aba0f91 Mark `linewrapping` `open_files` table as weak
We weren't correctly garbage-collecting `Doc`s, so we had `Highlighter`s 
stay alive over their due time.
2023-08-07 14:50:59 +01:00
Guldoman 528e5641fb Add mouse grab (#1501)
* Add mouse grab

We now also send mouse movement events only to the interested view.

* Add deprecation messages handler

* Make various `View`s respect `on_mouse_left`

* `StatusView`
* `TitleView`
* `TreeView`
* `ToolbarView`

* Fix scrollbar in `TreeView` not updating

We were in some cases sending outdated mouse positions to the scrollbar, 
which made it think that the mouse was hovering it.

This also updates the hovered item more responsively during scroll.
2023-08-07 14:50:59 +01:00
Jefferson González ba753593f3 Move lineguide below blinking cursor, fixes #1488 (#1511)
* Move lineguide below blinking cursor, fixes #1488

* Added config_spec custom color
2023-08-07 14:50:59 +01:00
Jefferson González 431c8f4a36 detectindent: fix wrong detection reported by Adam (#1500)
* The comment patterns had to come before the string ones
* The smallest indentation size is now taken into consideration even if
  it only occurs once, we just make sure its size is more than 1 space.
2023-08-07 14:50:59 +01:00
Adam 21db8313c1 Allowed for overrides of toolbar items, so plugins can add things if they want to with different fonts. (#1157) 2023-08-07 14:50:59 +01:00
Guldoman e7168a1e00 Restore horizontal scroll position after scale change (#494)
* Restore horizontal scroll position after scale change

* Consider `View` horizontal size when restoring horizontal scroll

This is needed because `View:get_h_scrollable_size` includes the 
horizontal size, while `View.scroll.x` doesn't.
2023-08-07 14:50:59 +01:00
Adam Harrison 6714732222 Fixing linewrapping bug to do with wordwrapping. 2023-08-07 14:50:59 +01:00
vqn 449f7d66c3 add autocompletion to multicursor (#1394)
* use Doc:remove
2023-08-07 14:50:58 +01:00
Adam 1becf35508 Disable `trimwhitespace` and `drawwhitespace` via their configs (#1446)
Instead of completely disabling them, we now use their internal toggle.

Also moved `drawwhitespace` commands inside the plugin.

---

* Fixed bug where commands would show even when plugin was disbled. Also removed antiquated way of disabling.

* Fixed typos.

* Also moved trimwhitespace out of config, if it already has a default enabled value of false.

* Changed documentation.

* Clarified comments.
2023-08-07 14:50:58 +01:00
Guldoman 3739bf0186 Make `TreeView` follow the current tab (#1411)
* Make `TreeView` follow the current tab

* Use `TreeView:toggle_expand` in `TreeView:set_selection_to_path`

We can't use `item.expanded` directly because we need to update the 
cached tree structure.
2023-08-07 14:50:58 +01:00
Jefferson González ce9d540e92 plugins scale: also rescale style.expanded_scrollbar_size (#1380) 2023-08-07 14:50:58 +01:00
Jefferson González 84039331a5 NagView: properly rescale on scale change (#1379)
* drop font option since style.font is always used
2023-08-07 14:50:58 +01:00
vqn b634b61866 Context menu fixes and keyboard navigation (#1338)
* fix Doc contextmenu not registering commands if scale plugin is not found
* fix TreeView contextmenu commands not working if the mouse hovers DocView
* add keyboard navigation to TreeView contextmenu
* fix incorrect contextmenu predicate
2023-08-07 14:50:58 +01:00
sammyette 3f917dcb45 feat: add option to only draw whitespace if it is within selection (#1312)
* refactor: remove sort_positions usage
* refactor: move draw conditional to has_any_selection and other changes
  - snake case (sssss)
  - break after finding selection
* fix: typo of config plugins
* fix: do check for show selected only properly
* feat: only draw within selection per substitution
* `drawwhitespace`: Make `show_selected_only` work properly

---------

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
2023-08-07 14:50:58 +01:00
Adam 4ef4b99c7a Abstracted open_doc out to allow for more easy overriding. (#1344) 2023-08-07 14:50:58 +01:00
Merlin Volkmer 75b6173dc9 language_md: add nix code block highlighting (#1323) 2023-08-07 14:50:43 +01:00
George Sokianos 65d95c7f40 Merge branch 'master' into amiga2.1 2023-01-08 21:04:04 +00:00
Guldoman 385ee69f94
`linewrapping`: Disable horizontal scrolling when enabled (#1309) 2023-01-05 16:02:12 -05:00
Guldoman 18e3542be0
Allow `TreeView` file operation commands when focused (#1256)
Impacts `treeview:{rename,new-file,new-folder,open-in-system}`.
Previously those were only available when the mouse was over the 
`TreeView`.
They now use the same predicate as `treeview:delete`.
2022-12-26 13:41:14 -04:00
Guldoman 97bfe503a0
`detectindent`: Limit subsyntax depth (#1253) 2022-12-20 22:28:29 -04:00
Jefferson González 902539b97a
trimwhitespace: expose functionality and extra features (#1238) 2022-12-20 18:13:56 -04:00
Guldoman 213dc7142e
`toolbarview`: Remove tooltip when hidden (#1251) 2022-12-20 18:07:29 -04:00
Jefferson González e152db2cce
plugins projectsearch: expose its functionality (#1235) 2022-12-14 11:53:20 -04:00
Guldoman 9d48441685
Add `regex.find_offsets`, `regex.find`, improve `regex.match` (#1232)
`regex.match` now behaves like `string.match`.
This required changes in the `tokenizer` and in the `detectindent` 
plugin.
2022-12-11 22:25:42 -04:00
Techie Guy 68595e4c7c
autocomplete: wrap the autocomplete results around (#1223) 2022-12-06 06:21:14 -04:00
jgmdev acebbfd88a linewrapping: fix enabled always by mistake introduced with #1190 2022-11-07 13:59:13 -04:00
Quinten Kock 4a5851afe5
Make linewrapping plugin recompute breaks before scrolling (#1190) 2022-11-06 22:34:07 -04:00
Guldoman 8a9bac7de3
Fix `drawwhitespace` drawing lines with different substitution kinds
When multiple substitution kinds are present in the same line, they're 
placed in the cache in an order that's spatially consistent only between 
items of the same kind.
Because we stopped drawing after we reached the first invisible 
substitution, the subsequent kinds weren't drawn even if they should 
have been.
2022-10-30 02:54:30 +01:00
jgmdev 0030c69524 plugin autocomplete: update partial on manual trigger 2022-10-25 17:20:31 -04:00
jgmdev 261292c6aa plugin drawwhitespace: allow newline substitution 2022-10-21 13:53:42 -04:00
jgmdev 5aaa5ab273 plugin lineguide: be strict on drawing to DocView 2022-10-15 21:56:34 -04:00
Guldoman 6b754eb628
Refactor scrollbar into its own file (#1124)
* Move scrollbar to its own file
* Don't call `Scrollbar` functions if `View` is not scrollable
* Allow horizontal scrolling in `Scrollbar`
* Add horizontal scrollbar to `View`
* Add `root:horizontal-scroll` command with `shift+wheel` keymap
* Prioritize vertical scrollbar hover
* Don't send mouse movement to vertical scrollbar when dragging horizontal one
* Fix clicking on horizontal scrollbar track
* Implement `start` scrollbar alignment
* Add documentation to `Scrollbar`
* Make `DocView` infinitely scrollable horizontally
* Handle horizontal scroll SDL event
2022-10-15 20:12:15 -04:00
George Sokianos 789004ea2c Updates and fixes for the latest available code, for 2.1 release 2022-10-10 19:06:19 +01:00
Adam d1c74f529a
Changed workspace to accommodate other views. (#1121)
* Added in the ability to pull scrolls from views, as all views have the capability of scrolling now.
2022-10-09 19:55:07 -07:00
Adam 1580d923d3
Fixing minor bug relating to TreeView's cache. (#1136)
Reviewed by Guldo; should fix things, merging.
2022-10-04 18:26:33 -04:00
jgmdev a65a2b293a plugins language_md: fixed some regressions, added caddyfile support 2022-10-02 21:45:54 -04:00
Jefferson González a0164d5902
language_md: don't require space at end on '_', '__', '___' (#1129) 2022-09-28 22:44:42 -04:00
Jefferson González 862ed9ad6a
plugin scale: added option to set default scale (#1115) 2022-09-15 00:54:44 -04:00
Adam 10d810b7d7
Added in simple directory search to treeview. (#1110) 2022-09-14 00:14:13 -04:00
jgmdev bead59a898 autocomplete: properly replace current partial symbol 2022-09-12 22:41:50 -04:00
Guldoman c25f83da90
Make predicate for some `TreeView` commands stricter
This avoids performing the `treeview:new-folder` command on ctrl + 
double click.
This happens because `ctrl+lclick` (which is the keybinding for 
`treeview:new-folder`) is triggered also by ctrl + double click, which 
isn't captured by anything else.
2022-08-21 20:03:32 +02:00
Jefferson González 76f71b2846
Merge pull request #1098 from Guldoman/PR_command_predicate_params
Allow command predicates to manage parameters, allow overwriting commands
2022-08-16 18:20:30 -04:00
Guldoman 06b9953777
Use `Object:is` instead of direct metatable comparison in `autocomplete` 2022-08-16 22:13:25 +02:00
Guldoman cf29a6a45f
Allow command predicates to manage parameters passed to the commands
When a command is performed with parameters, those are now passed to the
predicate.
The predicate can then return, after the validity boolean, any other
value that will then be passed to the actual command.
If the predicate only returns the validity boolean, the original
parameters are passed through to the actual command.

This allows predicates to manipulate the received parameters, and allows
them to pass the result of an expensive computation to the actual
command, which won't have to recalculate it.

String and table predicates will now also return `core.active_view`.
2022-08-16 22:13:16 +02:00
Ben Larisch a6bbd3c8a9
language_python: add syntax support for async/await 2022-08-16 09:52:46 +02:00
Adam 6ccc5f6dde
Steps to generalize toolbar and treeview. (#1088) 2022-08-09 14:53:30 -04:00
Guldoman d7f9b30d05
`drawwhitespace`: Invalidate cache on indent size change 2022-07-15 06:54:03 +02:00
Cyriaque Skrapits af3e2c971c
`language_python`: Add new patterns (#1074)
* `language_python`:  Add new patterns

This commit provides:
 - multiline comments support;
 - unicode string symbol highlighting;
 - class names as keyword2.
2022-07-13 11:06:42 -04:00
NCarrezDev 7f9287a7e7 [chore]: Delete useless $
follow up on Guldoman's comment
2022-07-13 09:16:32 +02:00
NCarrezDev 030dcc1e62 [chore]: Update syntax
Harmonizing the syntax files
Now inline comment are a single string instead of a table of strings.

-(language_c): Removed whitespaces breaking indent
-(language_html): Removed trailing whitespace
2022-07-06 10:15:44 +02:00
Jefferson González f49fd1b477
Merge pull request #1064 from Guldoman/PR_md_single_math
`language_md`: Limit inline math mode to the current line
2022-07-05 18:01:59 -04:00
Ben Larisch ce0d8b313c
language_python: add syntax support for match-case statement 2022-07-03 15:15:51 +02:00
Guldoman 79dd8779c4
`autocomplete`: Fix "Too many symbols" message when `Doc` has no name
Before, when a `Doc` had no name, an error was thrown.
2022-06-29 05:54:37 +02:00
Guldoman 92c2815aa4
`language_md`: Limit inline math mode to the current line 2022-06-28 20:09:36 +02:00
Guldoman 438ed6984a
`drawwhitespace`: Invalidate cache on font size change 2022-06-25 03:30:33 +02:00
jgmdev d2f9eeea07 renderer fonts: additions and improvements
* Allow passing font options to renderer.font:copy().
* Added renderer.font:get_path()
* Reintroduced set_size() for more faster font size changes
* Swapped copy wiht set_size on scale plugin for better performance
* Use code_font:copy() instead of renderer.font.load() on language_md to
  properly match user font now that font options are supported on copy.
* Added new changes to renderer docs
2022-06-23 18:08:04 -04:00
jgmdev 31d2024283 lineguide: added config spec 2022-06-23 18:07:27 -04:00
Chris 1e91080680
Improve `lineguide` plugin (#1056)
* Add more options to lineguide
* Allow lineguide plugin to load but remain disabled
* Use config.line_limit for default ruler
2022-06-23 15:24:57 -04:00
Katrina Grace beefb16469
language_html: Improve subsyntax highlighting (#1043)
* language_html: Improve subsyntax highlighting

- Adjusted `<script>`/`<style>` tag detection to not break when attributes like `defer` are added
2022-06-22 22:56:41 -04:00
jgmdev e0859e1e39 treeview: scale fallback sizes as pointed out by @Guldoman 2022-06-22 01:35:10 -04:00
jgmdev 7b411c3ea9 treeview: restore ability to disable toolbarview 2022-06-22 00:42:26 -04:00
Guldoman 76c1db97f5
`drawwhitespace`: Use `Docview` vertical line offset 2022-06-20 19:56:53 +02:00
a 8fd00b12cf
Add .cjs and .mjs for js syntax highlighting 2022-06-20 16:12:25 +02:00
jgmdev 173dd3aeb4 plugin treeview: fix crash
When the max_project_files is set to a higher value than the allowed
system maximum file descriptors, and opening a project directory that
causes dirmonitor to open a watch on a lot of files or directories, at
least on MacOSX it causes all system.* file functions to return nil
(for too many opened files) which breaks the project files scan.
2022-06-17 15:35:23 -04:00
Jefferson González 3dadbd3a49
Merge pull request #1038 from takase1121/PR/scale-step-gc
run GC between scale to prevent ram from exploding
2022-06-16 03:04:53 -04:00
Jefferson González 380cfb9a24
Merge pull request #1030 from Guldoman/PR_cache_draw_whitespace
`drawwhitespace`: Cache whitespace location
2022-06-15 21:08:09 -04:00
Guldoman 2d3abd2533
`drawwhitespace`: Invalidate cache on config changes 2022-06-16 00:03:25 +02:00
takase1121 42e0028f1c
run GC between scale to prevent ram from exploding 2022-06-15 22:56:52 +08:00
Guldoman f38723ea46
`drawwhitespace`: Cache whitespace location 2022-06-11 06:30:13 +02:00
Guldoman ed02a55cc1
`language_md`: Add math delimiters 2022-06-10 23:55:41 +02:00
jgmdev 3f206db69a initial documentation for better code completion 2022-06-07 22:09:34 -04:00
Jefferson González 439c27447f
Merge branch 'master' into PR_commandview_options2 2022-06-07 19:03:55 -04:00
Jefferson González 2fc20330a3
Merge pull request #1010 from Guldoman/PR_improve_multiproject_treeview
`TreeView` improvements for multi-project
2022-06-07 18:24:54 -04:00
jgmdev de63574b53 plugin linewrapping: added priority
Since the linewrapping plugin modifies some of the DocView line
calculation and positioning functions we need to make sure of loading it
before other plugins. This way we make sure that plugins that also overwrite
and depend on DocView functionality aren't using the original methods without
the linewrapping changes, which leads to wrong line and column calculations.
2022-06-03 04:13:54 -04:00
jgmdev 5da7467a5c plugin drawwhitespace: return line height on draw_line_text 2022-06-03 03:16:18 -04:00
Guldoman ec58b1f0bd
Add `text` and `select_text` to `CommandView` options 2022-06-02 19:30:51 +02:00
jgmdev 4157dd867c plugin drawwhitespace: added config spec 2022-06-02 00:07:34 -04:00
Jefferson González 59a5839ac9
Merge pull request #908 from Guldoman/PR_improve_whitespace
Improve `drawwhitespace` plugin
2022-06-01 21:59:45 -04:00
Guldoman 730ea0c91b
Make `TreeView` more multi-project-dir aware 2022-06-01 06:58:04 +02:00
Guldoman e94c996a26
Add `TreeView` helper functions to get previous/next item 2022-06-01 06:58:04 +02:00
Jefferson González c09715d0e1
Merge pull request #1004 from Guldoman/PR_commandview_options
Add options table to `CommandView:enter`
2022-05-31 16:38:36 -04:00
jgmdev 2d8a15f3ab plugins: dropped --lite-xl version tag 2022-05-31 16:34:14 -04:00
Guldoman 4f0d45d6ab
Don't check unnamed files in `autoreload` plugin 2022-05-31 01:03:59 +02:00
Jefferson González 7dc069aa8f
Merge pull request #995 from jgmdev/PR/plugins-settings-gui
plugins: added settings gui support
2022-05-30 16:12:49 -04:00
Guldoman 11e27c6fda
Use new `CommandView:enter` options table 2022-05-30 22:08:13 +02:00
Joshua Barretto 86e3f4a690 Made wrapping overflow optional 2022-05-30 17:13:21 +01:00
jgmdev 8bbca7c0b0 plugins: added settings gui support 2022-05-23 17:50:10 -04:00
jgmdev b9bb64a2f0 Merge branch 'master' into master-2.1 2022-05-22 22:26:47 -04:00
jgmdev 26e47f7583 plugin contextmenu: simplify predicate 2022-05-15 17:17:28 -04:00
Adam Harrison daeb2a8e04 Made sure we redrew things, added in a contingency in 'save' for times when we load a non-existent file, and added some checks. 2022-05-15 15:25:02 -04:00
Adam Harrison 5a0d213f3b Changed things over to use dirwatch. 2022-05-15 15:24:44 -04:00
Adam Harrison 20dc101229 As per request from jgmdev, added in ability to show nagview always. 2022-05-15 15:24:28 -04:00
Adam Harrison 173370694e Split out reload functionality to actual document, and added in a thread to check the document, in the cases where it wouldn't be covered by dirwatch. 2022-05-15 15:24:17 -04:00
Adam Harrison d56f4e1ee5 Modified autoreload to use new dirwatch infrastructure, and added in nagview to verify that fs changes don't stomp on our changes, unless you want them to. 2022-05-15 15:23:59 -04:00
Adam 36c4d5d9ed
Autoreload Nagview (#942)
* Modified autoreload to use new dirwatch infrastructure, and added in nagview to verify that fs changes don't stomp on our changes, unless you want them to.

* Split out reload functionality to actual document, and added in a thread to check the document, in the cases where it wouldn't be covered by dirwatch.

* As per request from jgmdev, added in ability to show nagview always.

* Changed things over to use dirwatch.

* Made sure we redrew things, added in a contingency in 'save' for times when we load a non-existent file, and added some checks.
2022-05-15 15:21:26 -04:00
Adam 6229f74ccd
Merge branch 'master' into master-2.1 2022-05-09 21:36:10 -04:00