Commit Graph

955 Commits

Author SHA1 Message Date
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
Guldoman 237f0c91cb
Open `LogView` on user/project module reload error 2022-06-05 04:29:24 +02:00
Guldoman 0b96be7af2
Make `common.merge` work with invalid arguments
This is needed because users could try to enable plugins with 
`config.plugins.plugin_name = true`.
Before, this would result in `common.merge` throwing an error; now it 
just returns a copy of the "base" table.
2022-06-05 04:10:51 +02:00
jgmdev ca46d8e261 style: move default colors to its own style file 2022-06-02 19:20:54 -04:00
Guldoman ec58b1f0bd
Add `text` and `select_text` to `CommandView` options 2022-06-02 19:30:51 +02:00
Guldoman 6c89a3e575
Add `show_suggestions` to `CommandView` options 2022-06-02 19:30:22 +02:00
Guldoman 8ce1ecb897
Fix `CommandView:enter` deprecation log 2022-06-02 06:42:58 +02:00
Adam Harrison 67066fc93a Added in defaults for dirwatch. 2022-06-01 18:36:00 -04:00
Guldoman d390eb248e
Fix tooltip not getting removed after `find-replace:replace` 2022-06-01 18:19:33 +02:00
Guldoman 295e6b7e5a
Allow `common.path_suggest` to specify a root directory
This will make relative paths start from `root`.
2022-06-01 06:57:38 +02:00
Guldoman 9a428648a9
Add `common.is_absolute_path` 2022-06-01 04:42:50 +02:00
Jefferson González 13d062479a
Merge pull request #1005 from Guldoman/PR_improve_logs
Add `warn` log level and backtraces
2022-05-31 16:38:47 -04: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 214f36157a plugins: only check mod version 2022-05-31 16:29:14 -04:00
Jefferson González c62cf5ce8c
Merge pull request #980 from jgmdev/PR/plugins-load-priority
plugins: add load priority support with '--priority:###' closes #978
2022-05-31 11:18:37 -04:00
Jefferson González bd742d5b3d
Merge pull request #999 from Guldoman/tokenizer_regex_groups
Allow regexes in `tokenizer` to split tokens with groups
2022-05-31 11:04:48 -04:00
Guldoman fae9af96bf
Expose function to create custom log entries 2022-05-31 02:35:56 +02:00
Guldoman db2d30caaf
Add `warn` log level 2022-05-31 02:26:42 +02:00
Guldoman c92f6a7b7f
Always show backtrace for `error` log entries 2022-05-31 02:26:18 +02:00
Guldoman d8efb1ab53
Show error if language plugin pattern has mismatching number of groups
The number of results from a pattern with groups must never be greater
than the number of token types for that pattern.

Also if a token type was undefined, it's now pushed as a `normal` one.
2022-05-31 02:05:37 +02:00
Guldoman 7ac776bef6
Fix UTF-8 matches in regex group `tokenizer` 2022-05-31 01:59:14 +02:00
Guldoman 11e27c6fda
Use new `CommandView:enter` options table 2022-05-30 22:08:13 +02:00
Guldoman e4a806a9d0
Add options to `CommandView:enter`
Now `CommandView:enter` can accept a table that specifies its behavior.

The old behavior is kept for compatibility.
2022-05-30 22:07:39 +02:00
Joshua Barretto 86e3f4a690 Made wrapping overflow optional 2022-05-30 17:13:21 +01:00
Joshua Barretto b3278f6360 Made moving to a line beyond the end of a document move the caret column to the end of the line 2022-05-30 15:40:46 +01:00
Guldoman 2a41002355
Allow using regex groups to split tokens
Before, this was only supported by Lua patterns.

This expects the regex to use the same syntax used for patterns. That 
is, the token should be split by empty groups.
2022-05-28 01:38:22 +02:00
Guldoman 14be51b1ec
Make `regex.match` return all the results 2022-05-28 01:21:41 +02:00
jgmdev b9bb64a2f0 Merge branch 'master' into master-2.1 2022-05-22 22:26:47 -04:00
jgmdev 4d3e8d8bd0 command predicates: added support for strict matching by appending '!' on string predicates 2022-05-15 16:10:57 -04:00
Jefferson González 0a66163c10
Merge pull request #987 from jgmdev/PR/fix-object-is-add-extends
object: made is() stricter and added extends()
2022-05-15 15:32:01 -04:00
Jefferson González 28346f13d9
Merge pull request #984 from jgmdev/PR/tokenizer-fix-utf8-bug
tokenizer: fix next utf8 char retrieval bug
2022-05-15 15:28:42 -04:00
Jefferson González 2b9f58b4f6
Merge pull request #982 from jgmdev/PR/keymap-changes
keymap: changes and docs
2022-05-15 15:27:58 -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 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 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
jgmdev 94430bcbd2 tokenizer: fix next utf8 char retrieval bug 2022-05-13 11:21:46 -04:00
jgmdev 59d91087e9 adjust and consolidate duplicated predicate code 2022-05-12 22:15:29 -04:00
jgmdev b8ed4a43f6 keymap: changes and docs
* Prevent adding duplicate bindings
* Clean reverse_map on overwrite or add direct
* Added get_bindings to complement get_binding
* Added doc comments for easier comprehension
* Check if command is function on add_direct
2022-05-12 21:16:02 -04:00
jgmdev fd0a433f59 object: made is() stricter and added extends()
Currently some plugins had/have issues with predicates that check
if active view is a docview to perform certain operations like draw
in the case of minimap or lineguide. Since is() was checking the
entire inheritance tree it was returning true for views that inherit
from the same parent, which caused CommandView to be matched along
DocView, etc... This change does the following to solve the issue:

* Make Object:is() only match the top level parent of the object which
  is more in line with what one would expect from a method named 'is'.
* Introduces Object:extends() which keeps the same functionality that
  Object:is() offered before.
2022-05-12 20:33:01 -04:00
Jefferson González e747dce7fe
Merge pull request #986 from jgmdev/PR/doc-upper-lower-utf8
Add utf8 support on doc lower and upper commands
2022-05-12 18:56:13 -04:00
Jefferson González 2a009186cf
Merge pull request #961 from Guldoman/PR_fix_doc_replace_results
Manage return values from "replacer" function in `Doc:replace`
2022-05-12 18:51:31 -04:00
jgmdev 1d1b3e0a09 Add utf8 support on doc lower and upper commands 2022-05-12 18:33:56 -04:00
jgmdev 359880e963 c core: fix extra utf8 build conflict on windows 2022-05-11 00:22:01 -04:00
Adam 6229f74ccd
Merge branch 'master' into master-2.1 2022-05-09 21:36:10 -04:00
Adam f1f8a9b3f2 TreeView Changes (#898)
* Change to 1 click as per RFC on discord, with 100% in favour.

* Added in the ability to specify  as a view name, so it doesn't modify the title, and also fixed a bug where if you clicked *over* the amount of times your config says, it wouldn't regsiter.

* Changed plugin to use keymap.
2022-05-09 21:33:22 -04:00
Adam Harrison ddc3a8842b Fixed dirwatch dummy, and scanning. 2022-05-09 21:30:13 -04:00
jgmdev b3fea8f880 plugins: add load priority support with '--priority:###' 2022-05-05 18:17:32 -04:00
Jefferson González 2c968073e4
Merge pull request #972 from Guldoman/PR_pretty_serialize
Add pretty printing to `common.serialize`
2022-05-05 01:35:04 -04:00
Jefferson González 308431d32a
Merge pull request #971 from jgmdev/PR/core-private-to-public
core: expose rescan_project_directories and configure_borderless_window
2022-05-05 01:34:32 -04:00
Guldoman 0ca0e36009
Open `LogView` in correct `Node`
Using `get_active_node` might result in a locked `Node`; calling 
`add_view` on that `Node` throws an error.

`get_active_node_default` always returns an unlocked `Node`.
2022-05-04 02:58:34 +02:00
Guldoman f8622efc01
Add pretty printing to `common.serialize` 2022-05-03 06:28:34 +02:00
jgmdev b5fe333345 core: expose rescan_project_directories and configure_borderless_window 2022-05-02 13:55:25 -04:00
Guldoman d3c38d699c
Merge pull request #966 from adamharrison/check-plugin-load-time
Added plugin load-time log.
2022-05-02 01:59:12 +02:00
Adam Harrison 548dbf67c2 Added in log to show total time. 2022-04-30 16:23:05 -04:00
Guldoman 2e0d0995d6
Add typeahead to `CommandView` (#963) 2022-04-30 16:09:40 -04:00
Guldoman 9de75988ba
Send `mouseleft` event when the mouse leaves the window (#928)
* Send `mouseleft` event when the mouse leaves the window

* Call `View:on_mouse_left` when the mouse leaves the `View`

Previously `View:on_mouse_left` was called only when the mouse left the
window, and it was called on every visible `View`.

Now it gets also called when the mouse "changes" `View`, and only the
last `View` the mouse was on will receive the event.
2022-04-28 21:50:34 -04:00
Adam Harrison b7db7cd533 Added plugin load-time log. 2022-04-28 21:42:53 -04:00
Guldoman ac42e6457a
Check if `USERDIR` doesn't exist in `core.delete_temp_files` 2022-04-28 01:55:07 +02:00
Guldoman f92f56d42e
Manage return values from "replacer" function in `Doc:replace`
Before the addition of multi-cursor support, we just returned the second 
return value of the "replacer" function to the caller.

With the introduction of multi-cursors, we naively summed the second 
return values for each cursor.
In some cases the "replacer" function doesn't return any second value, 
so we tried to do math with `nil`, thus throwing errors.

Now the second return value is added to a table which is then returned 
to the caller.
2022-04-27 21:53:35 +02:00
Guldoman 3950406750
Catch mouse clicks if `contextmenu` is open
Also disallow re-opening the `contextmenu` if it's already visible.
2022-04-27 17:55:46 +02:00
Adam 4934e741b3
TreeView Changes (#898)
* Change to 1 click as per RFC on discord, with 100% in favour.

* Added in the ability to specify  as a view name, so it doesn't modify the title, and also fixed a bug where if you clicked *over* the amount of times your config says, it wouldn't regsiter.

* Changed plugin to use keymap.
2022-04-26 18:29:05 -04:00
Guldoman a7ea84ae8f
Clamp scroll position when dragging the scrollbar without animations 2022-04-26 22:50:44 +02:00
Adam 4bf4851736 Asynchronous Reads for Dirmonitor (#930)
Change dirmonitor reads to be synchronous, in a secondary thread.
2022-04-26 12:13:39 -04:00
Adam Harrison 6f65168b0d Fixed windows dirmonitor issues. 2022-04-26 12:04:41 -04:00
Guldoman 444b3e3c66
Don't animate scrolling by dragging the scroll bar (#940)
Also added the `config.animate_drag_scroll` option to re-enable the 
behavior.
2022-04-26 09:54:11 -04:00
Guldoman 0c456eb664
Allow functions in `keymap` (#948)
This allows `keymap.add` to map shortcuts to functions.

If the function returns `false`, the next command is executed (as if the
`predicate` of a `command` failed).
2022-04-26 09:48:59 -04:00
Jefferson González e572c58f24
Add utf8 support to tokenizer (#945)
* add utf8 support to tokenizer

* wrap utf8 functions in string table using a 'u' prefix

* document new utf8 functions
2022-04-26 09:42:02 -04:00
Guldoman f42dbb0060
Add animation categories to enable finer transitions control (#941)
* Allow finer control over transitions

* Add categories to transitions
2022-04-25 20:35:35 -04:00
Adam 5df1640595
Merge branch 'master' into master-2.1 2022-04-24 13:42:24 -04:00
Adam 97174706fe
Asynchronous Reads for Dirmonitor (#930)
Change dirmonitor reads to be synchronous, in a secondary thread.
2022-04-24 13:40:58 -04:00
Guldoman bbac7e479c
Set the correct working directory for the AppImage version (#937) 2022-04-20 17:00:48 -04:00
Guldoman 9a5f8e72d0
Add `DATADIR` and `USERDIR` explanation in created user module 2022-04-18 21:14:50 +02:00
Adam Harrison d323917538
Added in check in case of nil. 2022-04-15 00:07:20 +02:00
Guldoman 43086a9c24
Fix missing pixel in scrollbar 2022-04-12 03:20:27 +02:00
Guldoman 4f434d1a41
Show `arrow` cursor when hovering `DocView` scrollbar track 2022-04-12 02:56:41 +02:00
Guldoman 48c371a638
Add scrollbar "track" and resize on hover 2022-04-12 02:56:30 +02:00
Guldoman 052c140787
Fix `DocView:on_mouse_released` not considering all parameters 2022-04-12 02:38:30 +02:00
Guldoman 202e42b568
Avoid calling `View:scrollbar_overlaps_point` uselessly
`View:on_mouse_moved` already updated `self.hovered_scrollbar`, so use 
that instead.
2022-04-12 02:37:21 +02:00
Adam Harrison 04adb10f97 Added in check in case of nil. 2022-04-03 16:44:02 -04:00
Adam Harrison 974fd9c8d5 Fixed windows dirmonitor issues. 2022-04-03 16:44:02 -04:00
Adam Harrison 11dfb5b1ca Apparenlty these were issues? What? 2022-04-03 16:44:02 -04:00
Adam 3479890ce5 Soft Line Wrapping (#636)
Added in soft line wrapping.
2022-04-03 16:44:02 -04:00
Adam Harrison 45a0382d50 Bumping version numbers. 2022-04-03 16:44:02 -04:00
jgmdev b0c005a5ac syntax: remove pattern re-ordering on optimization
* Introduces a flag that syntax writers can turn off named
  space_handling, turning it off means that your syntax will take care
  of handling the excessive amount of spaces that can slow down the
  tokenizer.
* Adds another pattern at the end of every single table that also
  improves tokenizer performance by matching words that weren't match by
  any of the synxtax patterns.
* Modifies language_md to turn off the provided space_handling and do its
  own since it has rules that require a space at the beginning, also
  handles long consecutives amount of dashes used in tables that degrade
  performance.
* This changes where discussed in collaboration with @Guldoman and
  @takase1121 thanks to all!
2022-03-29 22:11:14 -04:00
Jefferson González 7372d2f82d
Merge pull request #906 from jgmdev/PR/temp-file-other-dir
core: fixes and changes to temp files
2022-03-29 16:33:08 -04:00
Jefferson González aca1cd6b6b
Merge pull request #892 from jgmdev/PR/status-view-move-item
statusview: added functions for easy custom item ordering
2022-03-29 16:25:31 -04:00
jgmdev ca37644aa9 core: fixes and changes to temp files
* fix delete_temp_files() deleting in EXEDIR but temp_filename() was
  creating temp files in USERDIR
* make delete_temp_files() public so it can be used by plugins
* add optional `dir` parameter to both delete_temp_files() and
  temp_filename() to allow specifying a different directory, this is
  for example useful when generting markdown previews, the temp file
  should be generated in the project dir in case the readme references
  images that are relative to it, so the web browser can find them.
2022-03-28 22:36:49 -04:00
jgmdev e862fe9052 syntax: fix conflicts introduced with #896
* mainly the language_md got affected which has some exotic rules
* some other languages are also using spaces at start of pattern
  and even if not affected this change tackles that
2022-03-28 20:51:09 -04:00
Jefferson González 951f0913da
syntax: add pattern to boost tokenizer performance (#896) 2022-03-25 11:25:32 -04:00
jgmdev c82d6b08d9 statusview: added functions for easy custom item ordering 2022-03-21 18:40:14 -04:00
Guldoman 3765ef1d7a
Move cursor to the beginning or the end of its selection
When using `doc:move-to-{previous,next}-char` in a selection, we were 
moving the cursor to the character before the initial/after the last 
character of the selection.
Now we follow what other editors do and move it to just before the 
initial/just after the final character.
2022-03-20 04:28:26 +01:00
Jefferson González 30de42f4ab
Merge pull request #755 from Jipok/draw_tab_rework
rootview.lua: Refactor Node:draw_tab
2022-03-18 05:05:55 -04:00
Guldoman 000caf2e43 Allow opening non existing files from arguments 2022-03-18 01:09:02 -04:00
Guldoman 9763701cbf Reset syntax when a filename is provided 2022-03-18 00:36:25 -04:00
Guldoman fb4a5f3828 Add command to create a new named Doc 2022-03-18 00:34:15 -04:00
Adam Harrison ba5289dc75 Typo. 2022-03-17 16:57:18 -04:00
Adam Harrison 82325b6a08 Fixed a bunch of problems. Fixed left+click not allowing for square selections, fixed esc not exiting multicursor mode, and allowed cntrl+click to remove a cursor. 2022-03-17 16:55:52 -04:00
Jefferson González 1725a48ce2
Merge pull request #879 from jgmdev/plugins-skip-version
config: added skip_plugins_version
2022-03-11 17:30:36 -04:00
Jefferson González d0d0028472
Merge pull request #877 from jgmdev/statusview-commands
StatusView: added ability to hide and commands
2022-03-11 17:26:02 -04:00