Commit Graph
100 Commits
Author SHA1 Message Date
Guldoman 522d8a8094 findreplace: Fix number of total replacements 2022-06-23 00:16:16 +02:00
Guldoman 76c1db97f5 drawwhitespace: Use Docview vertical line offset 2022-06-20 19:56:53 +02:00
GuldomanandGitHub 205e554d87 Merge pull request #1047 from jgmdev/PR/cv-draw-visible
CommandView: improve performance by only drawing visible
2022-06-20 17:35:06 +02:00
Guldoman 2d3abd2533 drawwhitespace: Invalidate cache on config changes 2022-06-16 00:03:25 +02:00
Guldoman d169619f69 Warn if token type is a table when not needed 2022-06-15 21:31:16 +02:00
Guldoman 2e37e85a48 Add helper function to report bad patterns in tokenizer 2022-06-15 21:28:46 +02:00
Guldoman 5027a0f12b Fix malformed pattern check for group patterns in tokenizer
If the token type was a simple string (and not a table), the size of the 
string was used instead of `1`.
2022-06-15 19:33:58 +02:00
Guldoman 5b6b48320f Check if "open" pattern is escaped
Previously this check was only done for "close" patterns.
2022-06-12 04:19:05 +02:00
Guldoman c947e8a4d1 Convert more byte offsets to utf-8 pos in regex tokenizer 2022-06-12 02:55:36 +02:00
Guldoman f38723ea46 drawwhitespace: Cache whitespace location 2022-06-11 06:30:13 +02:00
Guldoman 685956cbdb Add Highlighter:update_notify to keep track of retokenized lines
This is helpful for plugins that need to know when a line has been 
retokenized.
2022-06-11 06:21:55 +02:00
Guldoman 99d328cfd7 Downgrade StatusView:get_items deprecation message to warning 2022-06-11 05:13:37 +02:00
Guldoman ed02a55cc1 language_md: Add math delimiters 2022-06-10 23:55:41 +02: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
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
Guldoman d390eb248e Fix tooltip not getting removed after find-replace:replace 2022-06-01 18:19:33 +02: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
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
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 4f0d45d6ab Don't check unnamed files in autoreload plugin 2022-05-31 01:03:59 +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
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
Guldoman 74f7389cac Make regex API return integers 2022-05-28 01:20:41 +02:00
GuldomanandAdam Harrison 8156836126 Fix ren_font_group_get_tab_size returning unexpected values
We were casting the `xadvance` to an int, so in some cases the resulting 
tab size was wrong.
2022-05-04 10:26:48 -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
GuldomanandGitHub d3c38d699c Merge pull request #966 from adamharrison/check-plugin-load-time
Added plugin load-time log.
2022-05-02 01:59:12 +02:00
GuldomanandGitHub 2e0d0995d6 Add typeahead to CommandView (#963) 2022-04-30 16:09:40 -04:00
GuldomanandGitHub 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
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
Guldoman a7ea84ae8f Clamp scroll position when dragging the scrollbar without animations 2022-04-26 22:50:44 +02:00
GuldomanandGitHub 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
GuldomanandGitHub 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
Guldoman 7dd83bb737 Fix ren_font_group_get_tab_size returning unexpected values
We were casting the `xadvance` to an int, so in some cases the resulting 
tab size was wrong.
2022-04-26 04:34:18 +02:00
GuldomanandGitHub 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
Guldoman b9957138ac Add launchable tag to AppStream xml 2022-04-21 00:41:15 +02:00
GuldomanandGitHub 1439b59d65 Improve performance of ren_draw_rect (#935)
We color a 1x1 `SDL_Surface` with the desired color. This surface is 
then stretched over the area we need to cover using `SDL_BlitScaled`.
This way we avoid having to do the blending ourselves.
2022-04-20 17:13:42 -04:00
GuldomanandGitHub 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
Guldoman 93b31211cb Apply drawwhitespace plugin only to DocViews 2022-04-12 04:05:59 +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
Guldoman e5c55e8abc Early break if autocomplete needs to update 2022-04-10 04:20:46 +02:00
Guldoman ffe698cef7 Consider last document line to gather autocomplete symbols 2022-04-10 04:11:59 +02:00
GuldomanandGitHub 50acf2e7e6 Fix keeping scroll position when restoring a DocView (#910)
Since 5526041da3 we check a pair of 
line&column to decide if we should scroll to the cursor.
Previously we only considered a single line&column.
2022-04-03 16:24:39 -04:00
Guldoman c70b5130a9 Improve drawwhitespace plugin
Add configuration options to specify:
- characters to substitute and their substitution;
- whether to substitute at the beginning, middle or end of the line;
- the color of the substitution;
- the color for the beginning, middle or end;
- the minimum number of white space to show in the middle.
2022-04-01 18:18:50 +02:00
GuldomanandGitHub 3e1fdc4157 Merge pull request #900 from buffet/add-lua-fallback-version
Add minimum version to lua fallback dependency to avoid confusion
2022-03-28 22:33:24 +02:00
Guldoman 46f9be2960 Hide hovered TreeView item when dragging the scrollbar 2022-03-20 04:46:57 +01:00
Guldoman 699655bebf Don't specify delta movement when simulating TreeView:on_mouse_moved 2022-03-20 04:45:14 +01: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
Guldoman 3ec0f38446 Make treeview:collapse select parent if current item can't collapse 2022-03-18 16:16:55 +01:00
Guldoman 2d5af22dc9 Don't draw treeview tooltip if its position is not defined 2022-03-18 16:10:24 +01:00
Guldomanandjgmdev 000caf2e43 Allow opening non existing files from arguments 2022-03-18 01:09:02 -04:00
Guldomanandjgmdev 9763701cbf Reset syntax when a filename is provided 2022-03-18 00:36:25 -04:00
Guldomanandjgmdev fb4a5f3828 Add command to create a new named Doc 2022-03-18 00:34:15 -04:00
Guldoman 5714da81f8 Always check if the beginning of the text needs to be clipped 2022-03-07 23:35:56 +01:00
Guldoman 240afa7abd Load project module on startup 2022-03-06 21:09:22 +01:00
Guldoman caefc9112a Force syntax patterns starting with ^ to match with the whole line
Before, syntax patterns/regexes that started with `^` didn't have the 
desired effect of matching with the start of the line.

Now those patterns are used only when matching the whole line.
2022-03-04 11:27:01 +01:00
Guldoman fbb893c6b1 Fix ^ regex matching when using an offset
Before, if `offset > 1` was used, the match would have failed because 
the beginning of the string was never met.

Now we force the beginning of the string to be the one specified by the 
offset.
2022-03-03 22:09:48 +01:00
Guldoman 3d879286a4 Use epsilon to compare values in move_towards 2022-03-01 22:41:54 +01:00
Guldoman 539f929e30 Allow intercepting filedropped events
The event is first sent to the underlying `View`; if not handled, it's 
managed as before.
2022-02-15 00:45:59 +01:00
Guldoman 5526041da3 Check entire selection to trigger DocView:scroll_to_make_visible
This is needed for example when a selection has both `line1` and `col1`
at 1, and the left arrow is pressed: `line2` and `col2` change, while
`line1` and `col1` don't, but we still want to scroll.
2022-02-11 06:16:29 +01:00
Guldoman 59ba759167 Don't scroll DocView when executing doc:select-all 2022-02-11 06:00:38 +01:00
Guldoman d4b8155cbc Update process status when calling process:running 2022-02-08 18:10:54 +01:00
Guldoman f23cb33f7c Ignore empty lines in line_comment 2022-02-07 19:22:43 +01:00
Guldoman 9a6cd2b453 Use SDL to manage color format mapping in ren_draw_rect 2022-02-03 01:50:43 +01:00
Guldoman e51c76c72b Assert for negative field in bit32 polyfill
This more closely matches the behavior of lua5.2.
2022-01-12 19:56:09 +01:00
Guldoman 51975472a9 Add bit32 polyfill globally 2022-01-12 00:07:53 +01:00
Guldoman 7eb9908f1a Improve bit32 polyfill 2022-01-12 00:07:14 +01:00
Guldoman d16e46dba5 Update website location 2021-12-23 23:26:52 +01:00
Guldoman a122d7e916 Correct get_key_name comment 2021-12-23 00:06:24 +01:00
Guldoman eac82e69fb Add parameters to core.on_dirmonitor_{modify,delete} 2021-12-22 23:43:56 +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
GuldomanandFrancesco Abbate 29318be9c7 Consume unmatched character correctly
We must consume the whole UTF-8 character, not just a single byte.
2021-12-20 12:04:20 +01:00
GuldomanandFrancesco Abbate 23f83857c5 Don't search if there are no files 2021-12-20 08:40:43 +01:00
Guldoman 2e9619f630 Directly link to our repo 2021-12-19 18:13:19 +01:00
Guldoman 4cf9d85986 Use new color themes repo 2021-12-19 18:12:34 +01:00
Guldoman 69de42b078 Set void to keyword2 in language_c and language_cpp plugins
Move `void` to the same syntax type used by other data types.
2021-12-15 18:20:17 +01:00
Guldoman 4faaf089ef Consume unmatched character correctly
We must consume the whole UTF-8 character, not just a single byte.
2021-12-11 03:43:33 +01: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 7cb2068bb8 Split Node and EmptyView from RootView 2021-12-06 22:28:29 +01:00
Guldoman 5029e2ce29 Add name to plain text fallback syntax 2021-12-02 22:34:49 +01:00
Guldoman d7afcb08b1 Check the entire path in TreeView new-file and new-folder commands 2021-11-30 01:11:35 +01:00