Commit Graph

970 Commits

Author SHA1 Message Date
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
Guldoman d817944170 Force showing tabs when dragging them 2021-10-02 18:37:00 +02:00
Guldoman dced6da03d Implement tab drag and drop 2021-10-02 18:36:59 +02:00
Guldoman 86632b68de Move single tab drawing to its own function 2021-10-02 18:36:59 +02:00
Adam Harrison f80f920bda Added in suggested changes. 2021-10-02 12:25:52 -04:00
Adam Harrison ee61b34084 Turned off whitespace by default. 2021-10-02 12:23:32 -04:00
Guldoman bf06aa1c4d
Load project module on project change (#571) 2021-10-02 16:38:45 +02:00
Guldoman b5f0b340d2
Add option to disable caret blinking (#572) 2021-10-02 16:38:10 +02:00
Guldoman 3b280401e4
Small cleanup of `scale` plugin 2021-10-02 03:24:35 +02:00
Guldoman ab0ca031fa
Add option to disable scrolling past the end (#566) 2021-09-30 13:10:38 -07:00
Rongfei Wang cf11d67895
Remove duplicate command declaration (#565) 2021-09-30 13:38:32 +02:00
Adam Harrison b6829cb041 Used copy. 2021-09-24 11:22:39 -04:00
Adam Harrison 425a4f600b Forgot to reset offset. 2021-09-24 11:22:39 -04:00
Adam Harrison 67032f72ac Removed subpixel mentions. 2021-09-24 11:22:39 -04:00
Adam Harrison e25f2e9c5c Removed font renderer. 2021-09-24 11:22:39 -04:00
Adam 8c32950f4b
Merge pull request #527 from adamharrison/native-interop
Native Plugins
2021-09-23 15:11:08 -04:00
Adam Harrison 466464d8a4 Mispelling. 2021-09-22 17:25:16 -04:00
Adam Harrison b8da46e10e Removed searchers[4]. 2021-09-22 17:24:22 -04:00
Adam Harrison 713ef787c2 Removed extra macros, used PLATFORM. Also removed MACOS, as it's redundant C code that's already encapsulated within PLATFORM. 2021-09-20 23:50:06 -04:00
Adam Harrison e13529444f Less C code, and more namespacing is better. 2021-09-20 23:42:39 -04:00
Adam Harrison 3ca127793a Incorporated some suggestions, and some functions. 2021-09-20 23:33:12 -04: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
Francesco Abbate 8d3680ab45 Scale custom syntax fonts for scale plugin
Close #539.
2021-09-19 18:51:44 +02:00
Guldoman 80a6b2245e
Reset syntax highlighting on file rename 2021-09-17 23:41:14 +02:00
Guldoman f6b6634868 Force showing tabs when dragging them 2021-09-17 22:25:05 +02:00
Guldoman 3eba7cd7f1 Implement tab drag and drop 2021-09-17 22:25:05 +02:00
Guldoman 6a3f59c423 Move single tab drawing to its own function 2021-09-17 22:25:05 +02:00
Adam Harrison 2ac7c7f09b Syntax. 2021-09-16 17:43:17 -04:00
Adam Harrison 4b828eff65 Markdown subsyntax highlighting. 2021-09-16 17:29:44 -04:00
Adam Harrison 10c3c9d4cf Undid deletion. 2021-09-16 16:24:07 -04:00
Adam Harrison 2987554097 Moving things into final positions. 2021-09-16 15:47:12 -04:00
Adam Harrison 377ce1cd06 Moved things around, fixed a few things up. 2021-09-16 12:37:17 -04:00
Guldoman 66bfff2e26 Fix wrong locked sibling check
Previously if the split type was "hsplit", but `locked_size_x` was 
falsy, `locked_size_y` was wrongly used.
2021-09-15 22:38:09 +02:00
Guldoman 9bfec4aca5 Ensure that the primary node always has a `View` 2021-09-15 22:38:09 +02:00
Guldoman fb955e4e12 Only check if sibling is locked in the split direction
If the sibling is not locked in the direction of the split, it should 
fill the space.
2021-09-15 22:38:09 +02:00
Guldoman 1e8031a0e8 Fix checking if sibling is locked when removing `View`s
We only checked if sibling was locked in the `x` direction.
2021-09-15 22:38:09 +02:00
Adam Harrison e9f48ce949 Added in sample plugin and tested things out. Works. 2021-09-14 00:13:30 -04:00
Adam Harrison a66a76f9c9 Added in searcher. 2021-09-13 23:40:01 -04:00
Francesco Abbate 25744d93ce Merge branch with modifications for 2.0.2 release 2021-09-11 08:19:40 +02:00
Francesco Abbate 218999dff8 Avoid bug when replacement stop at end of string
Detect when we are past the end of the string to avoid by
checking if byte is not nil.

Fix #510.
2021-09-10 14:55:04 +02:00
Francesco Abbate afd0672197 Use line/col to identify selection in replace command 2021-09-10 14:54:55 +02:00
Francesco Abbate cec1e4efb9 Do not fail search if there was an option change 2021-09-09 23:30:18 +02:00
Francesco Abbate d9afc40a17 Bring back command find-replace:select-next
Bring back the command like before to keep single selection but with
ctrl+f3 keybindings. Change the name of the new multi-cursor command
but keep the ctrl+d keybinding.
2021-09-09 21:40:41 +02:00
Guldoman aa0e083cb9 Allow `find-replace:select-next` to select more occurrences after wrap
The initial position for the search is defined by the last selection 
towards the end of the file.
After reaching the end of the file, it would always select the same 
selection to start the search from.

Now, we start the search from each selection, until a new occurrence is 
found.
2021-09-09 21:38:12 +02:00
Francesco Abbate 4964c30e12 Bring back command find-replace:select-next
Bring back the command like before to keep single selection but with
ctrl+f3 keybindings. Change the name of the new multi-cursor command
but keep the ctrl+d keybinding.
2021-09-09 19:12:56 +02:00
Guldoman 17185075c6 Allow `find-replace:select-next` to select more occurrences after wrap
The initial position for the search is defined by the last selection 
towards the end of the file.
After reaching the end of the file, it would always select the same 
selection to start the search from.

Now, we start the search from each selection, until a new occurrence is 
found.
2021-09-09 18:43:08 +02:00
Francesco Abbate 04250a206a Add previous find and replace in session 2021-09-09 15:42:16 +02:00
Francesco Abbate 403b7f6fb6 Add missing remove tooltip call 2021-09-09 15:42:16 +02:00
Francesco Abbate b440a22581 Remeber initial user text for hidden suggestions
When using hidden suggestions remember the text user was typing when
navigating suggestions.

Ensure also that in the previously searched expressiosn we have no
duplicate entries.
2021-09-09 15:42:16 +02:00
Francesco Abbate fa8b3b33b1 Use hidden suggestions also for replace dialog 2021-09-09 15:42:16 +02:00
Francesco Abbate 4bcc1cc07c Fix error with hidden suggestions
Avoid indexing a nil if there are no suggestions.
2021-09-09 15:42:16 +02:00
Francesco Abbate f85fe102d9 Implement hidden suggestions for find dialog 2021-09-09 15:42:16 +02:00
Francesco Abbate dfb64fbdf1 Do not add selection with newlines in replace
If the selected text containes newlines it doesn't make sense to
use it as the initial text in the "replace text" command view.

Do not use the selected text if a newline is found in the selection.

Fix #511.
2021-09-09 15:39:41 +02:00
takase1121 7a24dbb17e revert new keyboard bindings 2021-09-09 07:44:58 +02:00
takase1121 1a21c66353 add autocomplete:cycle
Some (probably lots) of people are used to tabbing through autocomplete.
now, tab is binded to autocomplete:cycle while enter is binded to
autocomplete:complete.
2021-09-09 07:44:58 +02:00
takase1121 5cc23348a1
reverse the order of args in keymap.unbind 2021-09-08 23:17:50 +08:00
takase1121 7e4236a82f
add keymap.unbind(), update contextmenu to use keymap.get_binding()
This is something probably people are looking for...
2021-09-08 23:11:36 +08:00
Guldoman 0a52861129 Revert horizontal scroll implementation 2021-09-08 07:11:50 +02:00
Guldoman 0a36e66aba Fix `treeview:open-in-system` command on Windows
The first argument is the title for the `CMD` window.
2021-09-07 22:35:56 +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
Francesco Abbate 2b277bb502 Fix problem with -psn argument on macOS 2021-09-07 06:44:15 -07:00
Francesco Abbate 67d7b894ae Add initial suggestion in open-project-folder 2021-09-07 15:23:41 +02:00
Francesco Abbate 90c721b823 Adopt bigger fonts by default 2021-09-07 15:11:20 +02:00
Guldoman f9c7eeeeb8 Check if session file returned anything 2021-09-07 15:03:00 +02:00
Guldoman 3278eebdad Avoid exposing `treeview` commands when not usable 2021-09-07 15:03:00 +02:00
Guldoman 9887dd4746 Make open files follow renames 2021-09-07 15:03:00 +02:00
Guldoman 59aa7f0090 Fix absolute path detection in `core.project_absolute_path` 2021-09-07 15:03:00 +02:00
Guldoman de4072e207 Avoid checking for unique selections on non-`DocView`s 2021-09-07 15:03:00 +02:00
Adam Harrison b7f2d1ad03 Forgot to return an 'n'. 2021-09-07 15:03:00 +02:00
Adam Harrison 7811660caf Fixed replace to make it multicursor-aware. 2021-09-07 15:03:00 +02:00
Timofffee 604626fa32 Fix macOS keymap 2021-09-07 15:03:00 +02:00
Adam Harrison 1d61cf989f Fixed cursor movement. 2021-09-07 15:03:00 +02:00
Adam Harrison d352eb1cb9 Fixed cursors moving around with removal and inserts with cursors. Also fixed drawing line highlights with multicursors. 2021-09-07 15:03:00 +02:00
Adam Harrison 9d4e944549 Added in two new VSC-style multicursor shortcuts. 2021-09-07 15:03:00 +02:00
Francesco Abbate 68c1cc606f Bring back min len autocomplete default to 3 2021-09-07 15:03:00 +02:00
Guldoman e93bbc559c Fix crash in project search when project has no files 2021-09-07 15:03:00 +02:00
Guldoman d3bd35b577 Use plain `string:find` when matching plugin directories 2021-09-07 15:03:00 +02:00
Guldoman 7f338fc993 Allow tabs to always be visible 2021-09-07 14:59:03 +02:00
Takase fb907c9bf4 increase code readibility 2021-09-07 14:59:03 +02:00
takase1121 97493a1a4e add doc:get_selection_text() 2021-09-07 14:59:03 +02:00
takase1121 30d3751632 remove unused variable 2021-09-07 14:59:03 +02:00
takase1121 14565b5226 more changes to logview
- remove draw_text_elipsis
- remove clip rect operations
- fix text drawing when expanded
- simplify code
2021-09-07 14:59:03 +02:00
takase1121 e25ea1196a add context menu options for logview 2021-09-07 14:59:03 +02:00
takase1121 622b162225 add core.get_log() 2021-09-07 14:59:03 +02:00
takase1121 afaf0a718d improve logview
The logview is now less cluttered.
The filename and stack trace (if any) is hidden by default.
The user can click on the log entry to expand it.
2021-09-07 14:59:03 +02:00
Francesco Abbate 28e8a98ffc Fix error in change-project-folder command 2021-09-07 05:21:45 -07:00
Francesco Abbate 3cc4cd1ada Fix error when opening root directory 2021-09-07 05:09:26 -07:00
Guldoman 444c929e3c Add commands to manage tab style 2021-09-07 07:53:03 +02:00
Guldoman 0d2a89cb76 Don't use threads in `detectindent`
As it's execution only happens on load/save.
2021-09-07 07:53:03 +02:00
Guldoman 501be5fdfe Use configured indent values if `detectindent` can't detect them 2021-09-07 07:53:03 +02:00
Guldoman e99c76f8b8 Update `detectindent` cache only after saving/reloading
Before, if the indent wasn't fully detected, `detectindent` would try to 
update every second. On files with very long lines this would cause 
stutters.

Now the indent is updated only once after saving/reloading.
2021-09-07 07:53:03 +02:00
Francesco Abbate 4f68f7fd92 Try to fix problem with js syntax of '/=' operator
The operator '/=' was wrongly considered by the js syntax file as the
beginning of a regexp literal.

With this modification we modify the pattern for regexp literals to not
match expressions starting with '/='.

This doesn't seem entirely correct because apparently javascript can accept
regexp literals starting with '/=' but the rule used by the javascript
lexer is not known.
2021-09-06 09:31:17 +02:00
Guldoman 371914af67
Check if session file returned anything 2021-09-04 00:32:01 +02:00
Guldoman e559afaefc
Add a simple cache to `DocView:get_h_scrollable_size`
This function gets called at every `core.step`, so we should avoid
having to recalculate the scrollable size every time, as it could get
very expensive on long lines.
2021-09-03 00:55:10 +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
Guldoman 46d1203d08
Fix absolute path detection in `core.project_absolute_path` 2021-09-02 18:58:24 +02:00
Guldoman f31312fd16
Avoid checking for unique selections on non-`DocView`s 2021-09-01 16:29:47 +02:00
Guldoman a920e5b0e6
Avoid setting a new file as dirty if it is empty 2021-08-31 23:16:02 +02:00
Adam Harrison e541236c22 Forgot to return an 'n'. 2021-08-31 16:21:40 -04:00
Adam Harrison 1c4a4e763e Fixed replace to make it multicursor-aware. 2021-08-30 22:56:33 -04:00
Adam 8d6ac47cd0
Merge pull request #451 from Timofffee/fix-macos-keymap
Fix macOS keymap
2021-08-30 13:37:07 -04:00
Guldoman 235b1f0385 Avoid recreating `line_numbers` table when a recalc is needed 2021-08-30 17:58:22 +02:00
Guldoman 4d0656ad7e Avoid recreating tables when calculating the longest lines 2021-08-30 17:58:22 +02:00
Guldoman 92bbb30d06 Split vertical and horizontal scrollbar-related functions and variables 2021-08-30 17:58:22 +02:00
Guldoman 4a03aec073 Set horizontal scroll size to be more in line with other editors
Only scroll enough to see the whole line.
2021-08-30 17:58:22 +02:00
Guldoman 2d33fdc656 Show correct mouse cursor when hovering the horizontal scrollbar 2021-08-30 17:58:22 +02:00
Guldoman 5c7b133e0b Add horizontal scrollbar
Classes and plugins that relied on having only the vertical scrollbar 
should continue working.
2021-08-30 17:58:22 +02:00
Guldoman f106993d0e Fix discrepancy in max line length
The line length calculated in `Doc:load` didn't account for the newline 
that gets added.
2021-08-30 17:58:22 +02:00
Guldoman 3e6afeccc0 Remove line from longest lines table only if needed
Checking if a line needs to be removed is faster than just trying to 
remove it.
2021-08-30 17:58:22 +02:00
Guldoman c16145d562 Define horizontal scrollable size for `DocView` 2021-08-30 17:58:22 +02:00
Guldoman f1ca00fbed Extend `View` to allow horizontal scrolling 2021-08-30 17:58:22 +02:00
Guldoman e52362e55f Make `Doc` keep track of max line length 2021-08-30 17:58:22 +02:00
Adam 3eb6f1dbd4
Merge pull request #430 from adamharrison/vsc-multicursor-shortcuts
Added in two new VSC-style multicursor shortcuts.
2021-08-30 10:52:09 -04:00
Francesco Abbate e94718c5c4 Bring back min len autocomplete default to 3 2021-08-30 14:35:42 +02:00
Timofffee 6e5452844c Fix macOS keymap 2021-08-30 16:21:16 +04:00
Adam Harrison 4ae16615e8 Fixed cursor movement. 2021-08-29 20:05:58 -04:00
Adam Harrison bbe4e21f52 Fixed cursors moving around with removal and inserts with cursors. Also fixed drawing line highlights with multicursors. 2021-08-29 17:54:57 -04:00
Guldoman ab6eac399c Fix crash in project search when project has no files 2021-08-29 11:13:39 +02:00
Guldoman 76334a7946 Use plain `string:find` when matching plugin directories 2021-08-29 11:11:19 +02:00
takase1121 30ccde896d
replace unpack() with table.unpack()
I have no idea unpack() is still used and how it still worked.
2021-08-29 09:14:12 +08:00
Adam Harrison 58f4963ade Added in two new VSC-style multicursor shortcuts. 2021-08-28 13:42:06 -04:00
Francesco Abbate ccba91261d Merge remote-tracking branch 'origin/fix-2.0.1' 2021-08-28 17:37:55 +02:00
Francesco Abbate f1c004411c Add missing home_encode for change-project-folder 2021-08-28 08:08:53 -07:00
Daniel Rocha 2b1c157a36 Refactored minimum scale bug fix code 2021-08-28 16:00:41 +02:00
Daniel Rocha 49ec7c88e8 Fix the additional four spaces to two spaces in the indent 2021-08-28 16:00:41 +02:00
Daniel Rocha dac3a9cba5 Fix minimal scale possible 2021-08-28 16:00:41 +02:00
Daniel Rocha 95e86b040b Refactored minimum scale bug fix code 2021-08-28 13:00:33 +02:00
Daniel Rocha 8335b11273 Fix the additional four spaces to two spaces in the indent 2021-08-28 13:00:33 +02:00
Daniel Rocha e342a017e1 Fix minimal scale possible 2021-08-28 13:00:33 +02:00
Francesco Abbate 06252382ec Fix focus problem with NagView with root:close-all
Fix provided by @Guldoman in PR:

https://github.com/lite-xl/lite-xl/pull/419
2021-08-28 00:21:29 +02:00
Francesco Abbate 4f8de02bcf Remove unused Object's method "implement"
Not used in the code base.
2021-08-28 00:08:30 +02:00
Francesco Abbate d46475532f Introduce View objects context property
Used to determine if an instance of the given class should
be closed or not when a project session is terminated.
2021-08-27 23:55:17 +02:00
Francesco Abbate 9592ce85f5 Revert "Further simplifies logic for active view in close-all command"
This reverts commit bb6b99b167.
2021-08-27 23:20:08 +02:00
Guldoman c7d044f178 Allow tabs to always be visible 2021-08-27 20:43:13 +02:00
Francesco Abbate a8f4c0c4e5 Set initial text for core:change-project-folder 2021-08-27 15:22:09 +02:00
Francesco Abbate bb6b99b167 Further simplifies logic for active view in close-all command 2021-08-27 14:42:57 +02:00
Francesco Abbate 7f4d9789d6 Simplify commit daf91676 about active view setting 2021-08-27 13:02:28 +02:00
Francesco Abbate 456f6eda65 Do not use os.exit to exit the application
Properly quit the application by terminating the core.run()
function. Otherwise a BadWindow event was happening when
closing the window.
2021-08-27 00:17:50 +02:00
Francesco Abbate daf916769f Fix bug with close-all command
There are really multiple things here in the close_all_docviews
function:

1. we reset the Node's tab_offset
2. we ensure the core's active_view is properly set
3. we close LogViews as well as DocViews

Some conditions seems to never happen but we stay safe and try
to cover all possible cases.
2021-08-27 00:13:40 +02:00
Francesco Abbate dc501cb41a Fix plugin version check 2021-08-25 23:45:18 +02:00
Takase 816ceb4493 increase code readibility 2021-08-24 11:35:53 +02:00
takase1121 cf7ebdad1f add doc:get_selection_text() 2021-08-24 11:35:53 +02:00
takase1121 1d9f04e7d6 remove unused variable 2021-08-24 11:31:22 +02:00
takase1121 6ac1428b51 more changes to logview
- remove draw_text_elipsis
- remove clip rect operations
- fix text drawing when expanded
- simplify code
2021-08-24 11:31:22 +02:00
takase1121 2fec3052ce add context menu options for logview 2021-08-24 11:31:22 +02:00
takase1121 7c3daa0f39 add core.get_log() 2021-08-24 11:31:22 +02:00
takase1121 cb639700b3 improve logview
The logview is now less cluttered.
The filename and stack trace (if any) is hidden by default.
The user can click on the log entry to expand it.
2021-08-24 11:31:22 +02:00
Francesco Abbate b76917ef9e Require modversion 2 2021-08-19 14:37:03 -07:00
Francesco Abbate d9e73a97ea Merge remote-tracking branch 'harens/macos-bundle' 2021-08-19 11:32:36 +02:00
harens 2d088256b1
Add unix-like behaviour on macOS
Closes https://github.com/lite-xl/lite-xl/issues/398
2021-08-18 13:26:51 +01:00
Adam Harrison b6af395fc7 2.0 changelog and modversion updates. 2021-08-17 20:24:44 +02:00
Adam 2ea62eee8f
Merge pull request #391 from adamharrison/fix-replace-tooltip
Added in additional function to remove tooltip after cancelling replace.
2021-08-14 09:12:20 -04:00
Adam 9e45b1de58
Merge pull request #390 from adamharrison/cursor-fixes
Fixed multilne cursors at the edges of docuemnts.
2021-08-14 09:12:13 -04:00
Adam Harrison 5f1e68b824 Added in additional function to remove tooltip after cancelling replace. 2021-08-14 09:11:07 -04:00
Adam Harrison 8e9c410d27 Fixed multilne cursors at the edges of docuemnts. 2021-08-14 08:59:37 -04:00
Adam 37dcc4725f
Merge pull request #376 from adamharrison/clipboard-fix
Added in a hash check to the system clipboard.
2021-08-12 15:30:50 -04:00
Adam db3e9cb914
Merge pull request #384 from adamharrison/fix-multi-directory
Handle proper path normalization if we begin with '..'.
2021-08-12 09:53:16 -04:00
Adam f3e750ccb4
Merge pull request #378 from adamharrison/close-other-tabs
Added in close others, and refactored close all.
2021-08-12 09:53:04 -04:00
Adam d9fc6d407b
Merge pull request #377 from adamharrison/regex-anchored
Fixed small bug on bootup, and added in a multiline qualifier to replacements.
2021-08-12 09:52:54 -04:00
Francesco Abbate 3396a6c802 Use the start.lua file in data/core as a template
Instead of having a separate start.lua.in file in the scripts directory
and no start.lua file in data/core we use the file data/core/start.lua
as a template for Meson to generate the final start.lua file for release.

In this way people naturally trying to run lite-xl from the source folder
will have a start.lua file albeit without a resolved version number.

Otherwise, when using run-local script or the meson install command the
meson-generated start.lua file will be used as it should be.
2021-08-12 10:35:32 +02:00
Adam Harrison e2a7578553 If multiple '..' handle correctly. 2021-08-11 20:54:03 -04:00
Adam Harrison 5e66f74f38 Handle proper path normalization if we begin with '..'. 2021-08-11 19:19:58 -04:00
Adam Harrison acd122bc34 Small fix. 2021-08-11 18:38:36 -04:00
Adam Harrison aa4d91a03f Reverted hash changes; simply copy entire clipboard. 2021-08-11 18:14:46 -04:00
luarocks 205b52b08a Revert language_lua 2021-08-11 23:33:00 +02:00
luarocks 0bafece6a6 Add textadept theme and correct language_lua just a bit 2021-08-11 23:33:00 +02:00
Adam Harrison c644ca7df6 keep_inactive -> keep_active 2021-08-10 23:29:39 -04:00
Adam Harrison 40c68ffcc6 Pairs -> IPairs 2021-08-10 23:18:30 -04:00
Adam Harrison 851dc07408 Added in close others, and refactored close all. 2021-08-10 23:14:40 -04:00
Adam Harrison 26a77542e3 Fixed small bug on bootup, and added in a multiline qualifier to replacements. 2021-08-10 22:01:28 -04:00
Adam Harrison 255c45b30b Since we're modifying the clipboard, actually makes way more sense to use this hash. 2021-08-10 21:29:33 -04:00
Adam Harrison 71e62ce84f Added in a hash check to the system clipboard. 2021-08-10 21:25:40 -04:00
Adam f3a8e264fe
Merge pull request #370 from adamharrison/home-fixes
Changed behaviour of home.
2021-08-10 14:46:48 -04:00
redtide 3468164518 Updated Meson configuration
- Added version and license metadata
- Configuration data to be used in configured files to set metadata
- Portable binary and directories in the main install directory
- Binary file installed in correct places for all supported platforms
- Freedesktop AppStream support
- Added missing files install rules
2021-08-09 22:26:16 +02:00
Adam Harrison 3c8da0fc3f Added in selection as well. 2021-08-06 18:09:36 -04:00
Adam Harrison 2bf56e67c5 Changed behaviour of home. 2021-08-06 18:08:08 -04:00