Commit Graph

265 Commits

Author SHA1 Message Date
Adam Harrison 64f66e5d1e Added in cut, copy and paste to the context menu. Also removed find pattern, as that's no longer a valid command. Also made it so commands only show up if their predicates are valid. 2021-11-23 21:03:38 -05:00
Guldoman cd2adb4a30
Apply again 1976facaf1
Use reverse search for `find-replace:previous-find`
2021-11-23 22:22:52 +01:00
Adam Harrison 96db380c73 Manual merge of into . 2021-11-23 15:57:22 -05:00
Guldoman 3d9901695b
Use the new `Doc:get_indent_info` throughout `core` 2021-11-20 04:37:15 +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 8e6f594790
Merge branch 'master' into replace-unpack 2021-11-17 08:42:08 +08:00
Adam Harrison 18959aebef Fixed predicate and minor propogation issue. 2021-11-16 19:12:39 -05:00
Adam Harrison 50c0659445 Also changed docview mousewheel into a scroll command. 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 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 612818ca05 Added in clicks to keymap. 2021-11-14 15:41:28 -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
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 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
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
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
Rongfei Wang b0b3485152 Remove duplicate command declaration (#565) 2021-10-02 18:39:22 +02:00
Rongfei Wang cf11d67895
Remove duplicate command declaration (#565) 2021-09-30 13:38:32 +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 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 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
Francesco Abbate 67d7b894ae Add initial suggestion in open-project-folder 2021-09-07 15:23:41 +02:00
Guldoman de4072e207 Avoid checking for unique selections on non-`DocView`s 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 28e8a98ffc Fix error in change-project-folder command 2021-09-07 05:21:45 -07: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
Francesco Abbate f1c004411c Add missing home_encode for change-project-folder 2021-08-28 08:08:53 -07:00
Francesco Abbate a8f4c0c4e5 Set initial text for core:change-project-folder 2021-08-27 15:22:09 +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 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
Adam Harrison aa4d91a03f Reverted hash changes; simply copy entire clipboard. 2021-08-11 18:14:46 -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 Harrison 2bf56e67c5 Changed behaviour of home. 2021-08-06 18:08:08 -04:00
Adam Harrison c461cfae93 Removed unecessary duplicates. 2021-07-20 14:50:40 -04:00
Adam Harrison 0777a6f0b8 Merged dev to master. 2021-07-20 14:39:50 -04:00
Adam Harrison 6330f4d596 Allowed find to function across different views. 2021-07-15 18:29:48 -04:00
Adam Harrison 0dda252096 Reverted find fixes. 2021-07-15 18:15:05 -04:00
takase1121 f4f33bd36b remove deprecated code 2021-07-15 18:01:24 -04:00
Adam e1ae94a01b
Merge pull request #318 from lite-xl/MacOSClose
Created an extra command, to implement appropriate cmd+w behaviour on Mac.
2021-07-09 14:30:48 -04:00
lqdev e5b2a7cbe8 reset blink timer when a new cursor is created 2021-07-01 14:50:28 +02:00
Adam Harrison fd3f25608f Created an extra command, to implement appropriat cmd+w behaviour on mac. 2021-06-27 13:18:54 -04:00
Adam Harrison 8b2fb67b9b Fixed regex replace. 2021-06-20 22:24:20 -04:00
Adam Harrison 46e939a3e6 Fixed a minor bug. 2021-06-20 21:34:42 -04:00
Adam Harrison 305921299f Added in tooltips, the ability to swap between different find modes with a keybind. 2021-06-20 21:22:37 -04:00
Adam Harrison bd02095a13 Fixed minor bugs; swap no longer returns from get. 2021-06-18 23:58:55 -04:00
Adam Harrison 704e04396f Rebased, and added the ability for ctrl to just create new cursors. 2021-06-18 17:33:55 -04:00
Adam Harrison 3541ab4aa1 Removed unecessary check. 2021-06-18 17:33:55 -04:00
Adam Harrison b5cbe3a2fb Added in the ability to iterate through cursors backwards. 2021-06-18 17:33:55 -04:00
Adam Harrison dfc57bd884 Used routine to add cursors in order correctly. 2021-06-18 17:33:55 -04:00
Adam Harrison 6915d86d59 Introduced the constraint that all cursors must be in order. 2021-06-18 17:33:55 -04:00
Adam Harrison 0f229b039d Fixed merging. Fixed selection undo stack. 2021-06-18 17:33:55 -04:00
Adam Harrison c494d52caf Used an inappropriate function in a selection loop. 2021-06-18 17:33:55 -04:00
Adam Harrison c6f7e473f0 That's what I get for not testing after a 'simple' refactor. 2021-06-18 17:33:55 -04:00
Adam Harrison 858f7a2a50 Added in missing boolean. 2021-06-18 17:33:55 -04:00
Adam Harrison b42708fe56 Cleaned up functions. 2021-06-18 17:33:55 -04:00
Adam Harrison 6c0d124410 Allows for rectangular selections with ctrl; also fixed tabbing. 2021-06-18 17:33:55 -04:00
Adam Harrison 08ab6cba05 Added in multiple clipboard line buffers. 2021-06-18 17:33:55 -04:00
Adam Harrison 37a3884ee2 Initial commit of multicursor. Next step is to investigate how multicursor works on various other IDEs and ape those. 2021-06-18 17:33:55 -04:00
Adam bdc37f1f6c
Added in remove file function. (#272)
* Added in remove file function.

* Changed namespace of rename and remove (now delete).
2021-06-17 22:26:27 +02:00
jgmdev e070dbebc1 Fix undeclared NagView findindex() by moving it to common. 2021-06-13 21:28:29 -04:00
Francesco 98164f6d4f
Integrate mkdirp function in common module (#265)
Move the function mkdirp into common to be generally available.

Use the new common.mkdirp from create_user_directory() from
core/init.lua replacing previous parent directory creation code
within the function.

The previous mkdirp function did not work on Windows where
absolute paths starts with a drive letter. The code from
create_user_directory() did not have this problem but was wrong
in the way it was creating the nested directories.

The new implementation in common.mkdirp fix both problems.
2021-06-13 19:50:42 +02:00
Takase 0fd1fa8872
Commands refactor (#257)
* remove unecessary check

* move command registration to core/commands
2021-06-07 23:00:29 +02:00
Takase 130b29438a
Allow creation of nested directories (#254)
* allow nested directories to be created

* fix / be turned into //

* refactor error handling

* refactor path splitting and mkdir calls

If a path exists it will now return immediately.

* fix typo

* remove possible trailing empty string

* fix bugs with path check
2021-06-07 22:44:35 +02:00
Adam Harrison 2170ab9649 Apologies for the subpar previous commit. This fixes the bugs in that one. 2021-06-05 00:50:25 -04:00
Adam Harrison 090d67f252 Exposed indent function, and made it more flexible. 2021-06-05 00:44:35 -04:00
Adam 248d70a8ca
Add PCRE to support regular expressions
Use regular expressions instead of Lua patterns for find and replace editor commands.

Syntax files can now use regex or Lua patterns as before keeping backward compatibility for plugins.
2021-06-02 21:27:00 +02:00
lqdev ea5e9b0ce5 fixed broken Doc:save monkeypatch 2021-06-02 19:11:59 +02:00
Adam 4ffb5e3672
Fixed commenting and uncommenting. (#224) 2021-05-28 08:17:49 +02:00
Francesco Abbate 34e38dd04a Fix missing check for filename when saving a file
Close #225
2021-05-27 18:53:31 +02:00
Adam Harrison f1a4bf8218 Changed to multiline select. 2021-05-26 17:52:01 -04:00
Francesco Abbate 10fde6e264 Implement lazy loading of directories
When the number of files in a project directory is above the max
limit switch back to a mechanism to read directory content only
when the corresponding folder is expanded in the treeview.

When the command core:find-file is invoked the command core:open-file
is executed instead because the complete list of the project's
files is not available.

When a project search is done we search through all the files within
the project dir without indexing them.

Address issues #217 #203 #183.
2021-05-26 14:22:10 +02:00
Adam Harrison 8acb3fae8c Fixed minor error that occurs when saving as after viewing a non-doc tab. 2021-05-24 17:26:16 -04:00
Francesco Abbate f17f5a4d6d Fix problem with filenames missing normalization 2021-05-24 15:58:49 +02:00
Adam a254d393db
Indent Enhancements (#202)
* Indent enhancements.

* Fixed to match style guidelines.

* Added in useful explanatory comment.

* Changed which selection we're using, as we don't want this kind of wrapping to happen.

* Fixed bug involving lines full of whitespace.

* Removed unecessary commit.

* Actually reverted function, so that we don't screw up commenting.

* Fixed hard tab issue.
2021-05-22 15:01:19 +02:00
Adam b278306fc9
Changed deindent, so that if the deindent runs into an unusual line with a partial indent at the front, it'll still de-indent that. (#193) 2021-05-19 22:41:28 +02:00
Adam e43f1b9df9
Unified open and saving style. (#189) 2021-05-17 09:29:51 +02:00
Adam 4c42dd4adc
Do not close command view on open-file is file is invalid or it is a directory
Added in a validation function which fires before submitting a command enter; found it incredibly irritating to try to open something, hit enter, only to be told I'd selected a directory, and then have to go through the whole process again. (#175)
2021-05-05 08:04:51 +02:00
Francesco Abbate 5766329313 Fix filename problem
Close #163
2021-05-01 19:27:29 +02:00
Francesco Abbate 857807b23a Use ab filename as initial text for open file command 2021-05-01 19:27:29 +02:00
adamharrison 2e7817f609
Use the active view's filename when opening a file 2021-04-25 20:58:56 +02:00
Francesco Abbate f7375924ab Make non-borderless mode work 2021-04-12 19:05:30 +02:00
Francesco Abbate 3b040aabc7 Implement unicode character replacements
Useful to draw whitespaces with alternate characters and colors
without slowing down the text rendering.

A new API is implemented. A renderer.replacements object can be created
to list the replacements.

In turns the function renderer.draw_text and draw_text_subpixel now accept
two optional arguments for replacements.
2021-04-01 18:05:59 +02:00
Francesco Abbate 04063ff47e Fix error introduced with commit c0ad86d 2021-03-18 15:46:44 +01:00
Francesco Abbate 94b99b658e Fix multi-line commands
When second position is at the beginning of a line do not include this latter.
2021-02-24 18:06:47 +01:00
Francesco Abbate 59fbf9cfc0 Merge branch 'master' into dev 2021-02-17 23:57:02 +01:00
Francesco Abbate 9b27180267 Use doc on_save hooks to reload user module 2021-02-17 20:10:39 +01:00
Francesco Abbate 1ce1c114ba Fix reload module problem on windows 2021-02-17 19:20:00 +01:00
Francesco Abbate 6369a7f760 Use tilde expansion when running save-as command 2021-02-16 22:54:00 +01:00
bud 63b024cb81 FIX: Use PATHSEP instead of hardcoded "/" path separator 2021-02-16 19:25:40 +01:00
bud b9fcb6e5ae ADD: test in doc:save(), if the file is the user module, automatically reload config 2021-02-15 22:09:25 +01:00
bud cc9aa23340 REMOVE: dont add reload on save hook in core:open-user-module, its automatically done in doc:save() 2021-02-15 22:09:06 +01:00
Francesco Abbate 08b010a2da Add command root:close-all 2021-01-13 16:51:42 +01:00
Francesco Abbate 431bf68e72 Fix missing gome expand in remove-directory command 2021-01-03 23:52:02 +01:00
Francesco Abbate 8d4ba0cb34 Fix behavior when selecting project directories 2021-01-03 15:35:35 +01:00
Francesco Abbate e548a6adb9 Fix directories management to always keep the project's directory 2021-01-03 12:02:07 +01:00
Francesco Abbate 7280ae47ab Fix missing absolute_path call in change-project-folder command 2020-12-30 14:40:03 +01:00
Francesco Abbate b91a84eb56 Fix project change and quit versus workspace plugin 2020-12-30 14:31:36 +01:00
Francesco Abbate f2faddbec7 Add command to create a directory in a new category "files"
Use the alt + (left click) is tree view to create a directory and
shift + (middle click) to remove a project directory.
2020-12-30 11:52:26 +01:00
Francesco Abbate ddd56ec615 Add command to remove a directory from the project
In addition directories can be removed with a mouse middle-click in the
tree view pane.
2020-12-28 15:51:16 +01:00
Francesco Abbate c042bfc907 Change project files output to not include a prefix '/' in filename
It make sense to not put the initial '/' in the filename as the name
is relative to the top directory it belongs to.

By removing the the initial '/' in the filename we can re-introduce the
variable

core.project_files

to stay compatible with standard Lite. The project_files variable will
always point to the files table of the first entry of
core.project_directories.
2020-12-28 10:26:27 +01:00
Francesco Abbate 4e260cd03e Add a comment about a possible improvement 2020-12-27 18:33:34 +01:00
Francesco Abbate df74781da8 Fix project search and status view for new add directory feature 2020-12-27 18:28:21 +01:00
Francesco Abbate e4fa196b33 Finalize add project directory feature 2020-12-27 11:32:52 +01:00
Francesco Abbate 9a12d47afd Add HOME directory expansion also for open file command 2020-12-20 00:31:49 +01:00
Francesco Abbate 4401f33c19 Move HOME expand/encode into common module 2020-12-19 23:53:29 +01:00
Francesco Abbate 35c87462a6 Use ~ for HOME directory in folder search 2020-12-19 16:31:42 +01:00
Francesco Abbate 9114148b45 Automatically reload style when saving the project user module 2020-12-10 17:56:53 +01:00
Francesco Abbate 6409b67ea2 Add core:restart function to restart the editor 2020-12-10 12:44:01 +01:00
Francesco Abbate e88adc0567 Move project manager into core init file 2020-12-08 16:57:57 +01:00
Francesco Abbate 3589d7d3c0 First implementation of unix-like data directory
It basically works by setting the data directory to

$prefix/share/lite-xl

where $prefix is determined so that $prefix/bin corresponds to EXEDIR.

The packages 'user' and 'user.*' are loaded from the directory
'$HOME/.config/lite-xl'.
2020-12-02 00:23:15 +01:00
Francesco Abbate bdaddea29a Fix behavior when using un-indent command over multiple lines 2020-11-18 15:52:53 +01:00
Francesco Abbate 1db0f703e7 Merge remote-tracking branch 'origin/master' 2020-11-17 10:28:20 +01:00
Francesco Abbate 82dc76dd00 Add recently visited files in the list when using find file command 2020-11-16 23:52:51 +01:00
Francesco Abbate 121f0e1aa0 Improve behavior for indent command with selection over multiple lines
Do not add indentation for the last line is not selected.
2020-11-16 11:52:41 +01:00
rxi de5cb4fa52 Improved behaviour of `doc:join-lines` when joining to empty line 2020-09-27 15:03:53 +01:00
rxi bd0644a5bb Added resetting of selection on intermediate find-text failure 2020-06-04 14:04:46 +01:00
rxi db8c5ea2aa Renamed core:command/file-finder => core:find-command/file 2020-05-30 09:11:42 +01:00
rxi 1b2fda2825 Changed block movement to mimic word movement 2020-05-28 13:55:25 +01:00
rxi 9c652086e8 Improved behaviour of and renamed `translate.next|previous_word_boundary` 2020-05-28 11:57:53 +01:00
rxi bc4bf3d384 Added core.set_active_view(); removed `focusable` boolean from View 2020-05-19 14:55:46 +01:00
rxi 4ae0d477c0 Made lite set project dir to CWD; removed core.project_dir
Fixes #100
2020-05-17 17:05:56 +01:00
rxi ed86f7d04e Fixed find-replace:select-next erroring on multiline selection 2020-05-12 20:05:17 +01:00
rxi 70f62f3c8a Added `doc:rename` command; changed command_view:set_text to take `select` argument 2020-05-09 16:09:07 +01:00
rxi 7479c1380d Added commands `root:shrink` and `root:grow` 2020-05-09 14:40:26 +01:00
rxi b08f870f47 Added stripping of carriage-returns when pasting 2020-05-09 14:22:13 +01:00
rxi 31820b36ef Moved `syntax` from `doc.highlighter` to `doc` 2020-05-08 20:29:22 +01:00
rxi 2642f7443f Added default text to find-replace's "new text" input 2020-05-08 13:55:23 +01:00
rxi 1d2a0aada5 Made `doc:toggle-line-comments` command skip empty lines 2020-05-08 09:07:13 +01:00