Commit Graph

846 Commits

Author SHA1 Message Date
Guldoman 955acf53a3
Merge pull request #673 from vincens2005/master
Add BigInt literal and numeric separators to js syntax highlighter
2021-11-22 22:23:23 +01:00
cukmekerb 65f1251767 JS hex BigInts and hex numeric separators 2021-11-22 12:15:19 -08:00
Adam 9869484ec6
Merge pull request #683 from Guldoman/named_languages
Add names to language plugins
2021-11-22 11:41:49 -05:00
Guldoman 23a0f6ca79
Speed up highlighter notify
Avoid calling `table.{insert,remove}` multiple times, as this causes 
multiple shifts in the `self.lines` table.
2021-11-22 06:23:16 +01: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 3176b467ca
Add names to language plugins 2021-11-21 03:46:43 +01:00
Guldoman 2de48b6ac8
Adapt `detectindent` to the new indentation architecture 2021-11-20 04:40:58 +01:00
Guldoman 3d9901695b
Use the new `Doc:get_indent_info` throughout `core` 2021-11-20 04:37:15 +01:00
Guldoman b77b1c0221
Add `Doc:get_indent_info`
It returns the indentation type, size and confirmation status, used by 
the `Doc`.
2021-11-20 04:36:58 +01:00
Guldoman d0a2c913f5
Pre-populate the highlighter
This avoids problems with calls to `[insert,remove]_notify` on lines 
that the highlighter has not yet added.
2021-11-20 01:18:37 +01:00
Guldoman f24aa64cd5
Add `soft_reset` to highlighter
This allows clearing the `lines` table without removing entries.
2021-11-20 01:15:13 +01:00
Joshua Minor 4f55555ca9 Selection expands by word or line on double or triple click followed by drag. 2021-11-19 09:46:13 -08:00
Takase d7c309d8e2
Merge branch 'master' into lineguide-config 2021-11-17 11:59:59 +08:00
Guldoman 6a7a02542f
Draw only visible whitespaces 2021-11-17 02:57:14 +01:00
Takase 8e6f594790
Merge branch 'master' into replace-unpack 2021-11-17 08:42:08 +08:00
takase1121 6d36f2684a
add polyfill for table.pack and table.unpack 2021-11-17 08:37:37 +08:00
Adam Harrison 18959aebef Fixed predicate and minor propogation issue. 2021-11-16 19:12:39 -05:00
Adam c58029df8b
Merge pull request #589 from adamharrison/clicks-keymap
Added in clicks to keymap.
2021-11-16 15:49:52 -05:00
cukmekerb 46f81e0bad add BigInt literal and numeric separators to js syntax highlighter 2021-11-15 09:20:34 -08:00
Takase 285ea4f495
Merge branch 'master' into keymap-improvements 2021-11-15 21:59:04 +08:00
Adam ca448c5fdb
Merge pull request #664 from Guldoman/highlight_caret_line
Highlight any line that contains a caret
2021-11-14 16:27:25 -05:00
Adam Harrison 2463c5d209 Made keymap more flexible. 2021-11-14 15:51:27 -05:00
Adam Harrison acc6667f57 Bug. 2021-11-14 15:45:46 -05:00
Adam Harrison d8473a3e00 Changed click prefixes to be numbers, as Takase suggested. 2021-11-14 15:44:54 -05:00
Adam Harrison 2931bdeb68 Can't forget mac. 2021-11-14 15:41:28 -05:00
Adam Harrison 50c0659445 Also changed docview mousewheel into a scroll command. 2021-11-14 15:41:28 -05:00
Adam Harrison 7babed1e6b Added in more broad strokes for clicking to match wheel. 's' is single, 'd' is double, 't' is triple, and no prefix will always take any amount of clicks. 2021-11-14 15:41:28 -05:00
Adam Harrison 7a3e8ed86a Added in mousewheel as part of this. 2021-11-14 15:41:28 -05:00
Adam Harrison c04dc648de Refactored things out. 2021-11-14 15:41:28 -05:00
Adam Harrison 1968d31b7c Keymap. 2021-11-14 15:41:28 -05:00
Adam Harrison 6bdcfc824d Rearranged things to make a bit more sense. 2021-11-14 15:41:28 -05:00
Adam Harrison 7905ddd26f Fixed propogation again. 2021-11-14 15:41:28 -05:00
Adam Harrison 4e313d9fc5 Propogated mouse clicks correctly. 2021-11-14 15:41:28 -05:00
Adam Harrison ce2ec9f442 Moved commands out to the outer event loop. 2021-11-14 15:41:28 -05:00
Adam Harrison 6f53ee1b69 Added in double, and triple clicking. 2021-11-14 15:41:28 -05:00
Adam Harrison 4a0d390a7c Added in macos keys. 2021-11-14 15:41:28 -05:00
Adam Harrison 612818ca05 Added in clicks to keymap. 2021-11-14 15:41:28 -05:00
Adam Harrison 1376eaf54d Made varaible anonymous. 2021-11-14 15:40:23 -05:00
Guldoman 6bc4fbb238
Restore `TitleView` only when needed
Before, every time the user came back from fullscreen, the `TitleView` 
was shown regardless of its previous status.
2021-11-09 22:21:45 +01:00
Guldoman b3eef15e7a
Highlight any line that contains a caret
Now lines with selections can be highlighted if they contain a caret.
2021-11-09 21:33:47 +01:00
Guldoman bcfd33a7df
Merge pull request #662 from adamharrison/suggest-directory-fix
Made it so that we originally start on the parent directory of the cu…
2021-11-08 01:03:59 +01:00
Adam Harrison 5b8c08e93a Missing parentheses. 2021-11-07 17:57:15 -05:00
Adam Harrison 24669293c7 Made it so that we originally start on the parent directory of the current project, but provide a list of recently used projects if on that directory. If a directory separator is added, then everything is as normal. 2021-11-07 17:54:42 -05: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
Adam 40f698e4bf
Merge pull request #625 from Guldoman/allow_closing_primary
Select a new primary node when closing the current one
2021-11-07 15:10:19 -05:00
Adam b7042fd9f7
Merge pull request #631 from Guldoman/fix_missing_subsyntax
Use `header` to get syntax only when provided
2021-11-07 15:09:50 -05:00
Adam Harrison 05dcddaeec Made plugin load order deterministic. 2021-11-07 13:14:48 -05:00
Adam 286183f917
Merge pull request #634 from Guldoman/fix_highlighter_holes
Don't insert `nil` in highlighter lines table
2021-11-04 20:45:03 -04:00
PIESEL cd10497b49
Use Python syntax highlighting for Ren'Py scripts.
Ren'Py is a very popular Python visual novel engine, which has it's own "coding language" (even GitHub shows it as a separate language) and it's own file extension.
Generally Python syntax highlighting works for the Ren'Py language.
2021-11-01 16:30:15 +01:00
Guldoman 9e721937af
Don't insert `nil` in highlighter lines table
When `highlighter:insert_notify` was called, a hole in the array was 
created.
If another call to `highlighter:insert_notify` happened before the hole 
was filled, a `Position out of bounds` error could have been raised.
2021-10-26 00:12:16 +02:00
Guldoman df665ddc38
Use `header` to get syntax only when provided 2021-10-25 14:06:07 +02:00
Guldoman 92db048e7c
Use plain search by default in `search.find` 2021-10-25 00:18:20 +02:00
Francesco Abbate 5cdd800910 Fix problem checking utf-8 cont at end of string 2021-10-23 15:03:09 +02:00
Francesco Abbate ffb66cefd7 Fix python docstring highlighting
From PR:

https://github.com/lite-xl/lite-xl/pull/624

contributed by @dflock.
2021-10-23 15:01:16 +02:00
Guldoman 331b8e90ec
Select a new primary node when closing the current one
The new primary node can be any non-locked leaf node that isn't already 
primary.
2021-10-23 03:34:24 +02:00
Francesco 6f732f67f9
Merge pull request #612 from Guldoman/fix_regex
Fix regex in tokenizer
2021-10-22 21:44:44 +02:00
Francesco Abbate ddb6196e9e Force project rescan on network filesystems 2021-10-21 23:57:17 +02:00
Francesco Abbate e9c16c4367 Add a limit for very slow filesystems
When adding a directory in a project we check if the filesystem is too
slow. If it is too slow we act as if the projects was files-limited by
the number of files but we show a specific warning.

This solution is not perfect but for very low filesystem it can limit
the problem. Otherwise the application would be totally irresponsive.
2021-10-21 23:18:31 +02: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 f18ac849fb Fix error introduced with 43fc35d7 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 9c52c420c5 Do not use normalize_path when not needed 2021-10-21 23:18:31 +02:00
Francesco Abbate f472c24c73 First attempt to treat correctly network volumes
On windows paths belonging to network volumes will be gives like:

\\address\share-name\path

Now the code recognize these paths and treat them correctly.
2021-10-21 23:18:31 +02:00
Guldoman 780c8c6d0d
Improve check for `find-replace` commands using `has_unique_selection` 2021-10-16 03:02:42 +02:00
Guldoman ef60b24f63
Check both values returned by `Node:get_locked_size` 2021-10-16 02:56:01 +02:00
Adam Harrison f2488fdd8d Added in support for font groupings. 2021-10-12 23:24:52 -04:00
Guldoman 8a516d35ce
Correctly identify the start of the next character in `tokenizer`
When moving to the next character, we have to consider that the current 
one might be multi-byte.
2021-10-11 22:37:31 +02:00
Guldoman 1872e82141
Make `regex.match` return the appropriate `end` index
This makes its behavior similar to `string.find`.
2021-10-11 22:32:50 +02:00
Guldoman 3a71528087
Allow specifying offset for `common.is_utf8_cont` 2021-10-11 22:18:02 +02:00
Francesco Abbate 0d2166c9ce Correct Node's clipping rectangle
Fixing the Node's clipping rectangle make the clipping in DocView:draw()
partially redundant. This latter is now no longer needed to clip
on the right when drawing the document's lines but it still serves to
the purpose of clipping on the left, before the gutter region.
2021-10-11 09:25:38 +02:00
Francesco Abbate 8b634daa66 Use rounded value for node's size when splitting
Rouding node's size to an integer value ensure drawing are pixel
perfect in sizing.
2021-10-10 21:48:16 +02:00
Francesco Abbate c7aa3ebe01 Fix clipping error in docview 2021-10-10 21:44:16 +02:00
Francesco Abbate cb08c5cbb7 Fix dirty pixels problem on window's right side
The last column of pixel on the window's right side isn't correctly
drawn and pixels appear dirty and more noticeably when the a NagView
message was previously shown, a stripe of red pixels remains on the right.

We use now a more souding roundig scheme. Now the rectangles to clip or to
draw are passed around as Lua numbers without any rounding. In turns, when
the rect coordinates are passed to the renderer we ensure the border of the
rect are correctly snapped to the pixel's grid. It works by computing the
coordinates of the edges, round them to integers and then compute the rect's
width based on the rounded coordinates values.
2021-10-10 14:52:55 +02:00
Francesco 228d6ff101
Merge pull request #466 from Guldoman/new_not_dirty
Avoid setting a new file as dirty if it is empty
2021-10-10 10:05:19 +02:00
Guldoman 3a1274fd08
Merge reverse find functions for lua patterns and regexes 2021-10-10 01:11:41 +02:00
Guldoman cfe0c79a04
Simplify reverse search
Remove `plain_rfind` optimization.
2021-10-10 01:11:40 +02:00
Guldoman af925d603b
Fix `doc` selection in `findreplace`
Use `last_view` if `active_view` is `CommandView`.
2021-10-10 01:11:40 +02:00
Guldoman 1976facaf1
Use reverse search for `find-replace:previous-find` 2021-10-10 01:11:38 +02:00
Guldoman e7be9652c9
Add `find-replace:select-previous` 2021-10-10 01:10:52 +02:00
Guldoman 56eace627a
Add reverse option to `search.find` 2021-10-10 01:10:47 +02:00
Francesco Abbate 7dd5699c96 Use dmon events in reload plugin 2021-10-08 23:15:25 +02:00
Francesco Abbate 911a3cee08 Report dmon modify events 2021-10-08 23:13:50 +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 92362586df Improve highlither for document edits
The syntax highlighter keep a cache of the documents like tokenization.

In order to minimize the amount of tokenize re-computations we insert some
emtty lines or remove some lines in the highlither lines corresponding to
the lines added or removed to the document.
2021-10-08 21:28:27 +02:00
Francesco Abbate 7a435a568a Fix error in incremental syntax highlighter
In the highlither thread We should accept a previously generated line tokenization
past first_invalid_line only if the text is the same. The text can change because of
insert or remove operations.

Close #573.
2021-10-08 21:27:57 +02:00
Francesco Abbate 44d7f3738f Improve highlither for document edits
The syntax highlighter keep a cache of the documents like tokenization.

In order to minimize the amount of tokenize re-computations we insert some
emtty lines or remove some lines in the highlither lines corresponding to
the lines added or removed to the document.
2021-10-07 19:19:08 +02:00
Francesco Abbate 8477818c96 Fix error in incremental syntax highlighter
In the highlither thread We should accept a previously generated line tokenization
past first_invalid_line only if the text is the same. The text can change because of
insert or remove operations.

Close #573.
2021-10-07 19:03:16 +02:00
Guldoman db3643653e
Sanitize selections after redo 2021-10-02 22:03:52 +02:00
Francesco eb79381c89
Merge pull request #521 from adamharrison/remove-font-renderer
Remove Font Renderer + CP Replace + libagg
2021-10-02 18:45:31 +02:00
Francesco Abbate 72c950338c Enable always show tabs by default 2021-10-02 18:44:05 +02:00
Guldoman 20ddbd6e9f Load project module on project change (#571) 2021-10-02 18:39:23 +02:00
Guldoman 57bfb67f6a Add option to disable caret blinking (#572) 2021-10-02 18:39:23 +02:00
Guldoman 468229e4d0 Small cleanup of `scale` plugin 2021-10-02 18:39:23 +02:00
Guldoman f6b9d9ab67 Add option to disable scrolling past the end (#566) 2021-10-02 18:39:22 +02:00
Rongfei Wang b0b3485152 Remove duplicate command declaration (#565) 2021-10-02 18:39:22 +02:00
Adam Harrison 291616df3f Removed extra macros, used PLATFORM. Also removed MACOS, as it's redundant C code that's already encapsulated within PLATFORM. 2021-10-02 18:39:03 +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
Francesco Abbate d067cc8577 Scale custom syntax fonts for scale plugin
Close #539.
2021-10-02 18:37:01 +02:00
Guldoman e2f7c984de Reset syntax highlighting on file rename 2021-10-02 18:37:00 +02:00