Commit Graph

358 Commits

Author SHA1 Message Date
Francesco Abbate e4fa196b33 Finalize add project directory feature 2020-12-27 11:32:52 +01:00
Francesco Abbate 39181a56fd Use relative path for filenames in project directories 2020-12-27 09:47:58 +01:00
Francesco Abbate 5449781353 Minor cleanup to project directory stuff 2020-12-26 23:39:27 +01:00
Francesco Abbate 54518c438d Cosmetic changes to names from previous commit 2020-12-26 23:29:18 +01:00
Francesco Abbate ec730e9520 Test configuration with project_files stored separately for each directory 2020-12-26 21:22:57 +01:00
Francesco Abbate 2f50f21f57 Preliminary version of projects with multiple directories 2020-12-26 16:48:08 +01:00
Francesco Abbate 9e8e8f7543 Remove priority run mechanism 2020-12-26 11:30:20 +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 c3dd506bd7 Fix bug with lost primary node in rootview
It was possible to lose the primary node thus possibly preventing the
opening of new documents.
2020-12-15 13:30:49 +01:00
Francesco Abbate 499f085045 Use get_primary_node instead of Rootview:get_primary_view 2020-12-15 12:51:36 +01:00
Francesco Abbate eadbe41064 Add core.on_quit function for plugins
To be used for plugins like workspace from exi/lite-plugins
2020-12-14 13:57:24 +01:00
Francesco Abbate 3a38ded396 Use core.reload_module instead of style.load 2020-12-13 13:04:06 +01:00
Francesco Abbate 1fc0409163 Merge branch 'project-manager' 2020-12-12 20:27:07 +01:00
Francesco Abbate 3b30bfa18b Improve left/right scrolling behavior for DocView
With the new behavior when moving right and triggering a scroll in the
right direction a subsequent movement left do not longer triggers a
scrolling to the left.
The scrolling to the left happens only when needed for the visibility of
the current position.

In other terms with the old behavior the scrolling was purely a function
of the position and was adjusted even when not strictly needed for the
visibility of the cursor.
Now the scrolling is no longer a pure function of the position but it
has a "memory" behavior. The scrolling will be adjusted only if needed
to accommodate the position of the cursor.

Reduce also the width of the margin when the scrolling will be
triggered and calculate as a function of the font character width.

With the modification now Lite behaves like the other editors. In
addition the selection of text with the mouse is much more easy when
a scrolling of the line is needed.
2020-12-12 20:26:27 +01:00
Francesco Abbate 40ac899360 Restore core.quit and core.temp_filename to be compatible with Lite 2020-12-12 00:05:11 +01:00
Francesco Abbate 2373c63a0b Complete the initial user configuration file 2020-12-11 14:49:03 +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 33109e6110 Fix responsiveness problem of open-folder command 2020-12-09 15:45:16 +01:00
Francesco Abbate ebcfa63de1 Fix centerings of text in EmptyView 2020-12-08 23:36:50 +01:00
Francesco Abbate ba898b50fc Force a clear of treeview on switch project 2020-12-08 23:35:49 +01:00
Francesco Abbate 8448eee79f More accurate list of recent projects 2020-12-08 18:49:58 +01:00
Francesco Abbate f882957ebc Experimentally add priority run when scanning project files
Avoid yielding when a first scan is required but seems quite
ineffective.
2020-12-08 16:59:05 +01:00
Francesco Abbate e88adc0567 Move project manager into core init file 2020-12-08 16:57:57 +01:00
Francesco Abbate c0f0325bbb Fix behavior of project manager to store directories 2020-12-08 09:42:11 +01:00
Francesco Abbate a3adfeb8f6 Begin reworks of project manager 2020-12-07 18:06:58 +01:00
Francesco Abbate ebaa2b4f26 Fix bug related to creation of user's init file 2020-12-07 17:38:36 +01:00
Francesco Abbate ca9bf21819 Reword name for identifying primary view 2020-12-06 13:24:55 +01:00
Francesco Abbate 23575b309e Fix syntax error with previous commit 2020-12-06 11:37:05 +01:00
Francesco Abbate 1c4b8cf315 Fix documentation and behavior for 1.13 release 2020-12-06 11:23:33 +01:00
Francesco Abbate 745dd99e97 Use original document views node to open a new document
Used when the active view is a locked node.
2020-12-06 01:03:54 +01:00
Francesco Abbate 926e004c41 Preliminary version of project manager
Adapted from contribute rxi/lite-plugins but changed to avoid restarting
the application when switching project.

Current problem:
- the reload of the treeview take some time without any feedback for the
  user
2020-12-06 00:57:27 +01:00
Francesco Abbate afda299fe4 Implement optional font rendering options
The user can now choose antialiasing grayscale and subpixel and hinting
non, slight or full.
2020-12-04 16:15:54 +01:00
Francesco Abbate a337f893d9 Implement user's config as init file and add directory into package.path
Create the user's config init file if lite user's config directory does
not exists.

No longer use the awkward package.searchers but instead add user's
config dir at the end of package path.
2020-12-02 16:03:31 +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 70412b520b Fix cursor blinking problem
The problem was that when the editor had no events the cursor was not
blinking because the event loop was blocking on wait_event.

Now we no longer calls wait_event without a timeout if the windows has
the focus. When the window has the focus the timeout is set to 1 / fps
so that the cursor can blinks.

In addition we react to the "focus lost" event to ensure the documents
are redrawn without the cursor.
2020-11-21 16:36:32 +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 4a8884ef70 Increase default max limits for symbols
The previous limit, 2000, was may be too small and may prevent auto-complete from working for some big source file.
2020-11-17 12:33:57 +01:00
Francesco Abbate 1db0f703e7 Merge remote-tracking branch 'origin/master' 2020-11-17 10:28:20 +01:00
Francesco Abbate cdcd89d6d7 Merge remote-tracking branch 'rxi/master' 2020-11-17 10:24:27 +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 16e6a6db9d Stop scanning project file when a maximum limit is reached
To avoid excessive memory usage when opening in a directory with too many files.

Introduce the config variable config.max_project_files to choose the limit.

The mechanism introduced avoid using excessive memory but it fails to
let user access all the files in the directory. A better implementation
should not impose any limits but read each subdirectory on-demand, only
as they are expanded in the tree-view.
2020-11-16 18:12:55 +01:00
Francesco Abbate 7a856be6e4 Fix error when opening the first document if project view was active 2020-11-16 18:12:31 +01:00
Francesco Abbate edaa8fb42b Add a mechanism to avoid blank window at startup 2020-11-16 14:49:41 +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
Francesco Abbate eb41569e8d Implement limits for maximum number of symbols in autocomplete
Implemented to avoid excessive memory usage when loading big files with
many unique words.
2020-11-14 23:48:56 +01:00
rxi de5cb4fa52 Improved behaviour of `doc:join-lines` when joining to empty line 2020-09-27 15:03:53 +01:00
Francesco Abbate 14ec61511d Merge remote-tracking branch 'rxi/master' 2020-07-04 22:08:25 +02:00
rxi 094cf0cc2c Fixed shift+click select behavior 2020-06-26 10:44:56 +01:00
rxi 53d555b362 Added support for mouse double/triple click+drag selection
Resolves #159
Resolves #161
2020-06-25 13:41:46 +01:00
Francesco Abbate fe0dda8309 Merge remote-tracking branch 'rxi/master' into agg-font-renderer 2020-06-16 15:00:47 +02:00
Francesco Abbate 2c6bd874fa Avoid running when there are no events and threads do not need to run 2020-06-16 14:54:08 +02:00
rxi 7517d0ef55 Changed EXEDIR to be used as default project dir 2020-06-13 08:56:13 +01:00
rxi ba6c14846b Added file-header pattern support to `syntax` 2020-06-08 16:11:22 +01:00
rxi bd0644a5bb Added resetting of selection on intermediate find-text failure 2020-06-04 14:04:46 +01:00
rxi 3569abcb53
Merge pull request #133 from 6r1d/master
Fix for keypad enter issue
2020-06-04 13:17:33 +01:00
rxi 18de4552e2 Made tab's text left-aligned if wider than the tab 2020-06-03 13:34:10 +01:00
rxi 4b167e86c6 Fixed bug in Highlighter.invalidate() when setting first_invalid_line
The value should not be updated if the current first_invalid_line is less than
the new invalid line index
2020-06-02 22:50:03 +01:00
Victor Gridnevsky a6f52197d0 Fixes keypad enter issue (#131) 2020-06-02 13:26:16 +03:00
rxi 508b6fb73a Improved RootView's EmptyView 2020-05-30 14:58:31 +01:00
rxi db8c5ea2aa Renamed core:command/file-finder => core:find-command/file 2020-05-30 09:11:42 +01:00
rxi 7fbefe40d5 Made `system.set_window_title` only be called on title change 2020-05-30 08:53:48 +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 74755f5b4a Simplified implementation of `core.temp_filename()` 2020-05-27 11:38:42 +01:00
rxi e7cf551e22 Changed EmptyView text from `empty` to `lite` 2020-05-26 10:33:07 +01:00
rxi 064b6d0b95 Fixed changing of cwd and loading of commandline files
the current-working-directory is now set at the start of `core.init` after the
absolute path for all filename arguments have been resolved
2020-05-26 10:26:20 +01:00
rxi 257b9ab753 Added `core.temp_filename()` 2020-05-25 08:58:12 +01:00
rxi c2d27ab3f7 Removed `core.project_dir` 2020-05-24 13:50:32 +01:00
rxi 82e33dd2de Moved event-waiting when not focused to after run_threads() 2020-05-24 13:43:34 +01:00
rxi 946c125fd4 Changed `core.redraw` to be set to `true` by default
As the window isn't created until the first frame is drawn this is required to
assure the window is ever shown without relying on the assumption that some
other part of the program would have set this to true
2020-05-24 08:04:47 +01:00
rxi 28b1844a8b Added support for dropping a folder onto the window 2020-05-23 11:31:08 +01:00
rxi e45b3e2bc0 Minor renaming in rootview 2020-05-23 09:40:42 +01:00
rxi e7320c2291 Made RootView:open_doc() try to use previous node if current node is locked 2020-05-22 15:50:27 +01:00
rxi 7aabfebfa0 Fixed mouse-position resolution when dropping a file 2020-05-20 10:33:08 +01:00
rxi 08ce7e2563 Fixed stuck mouse-drag-selection on dropped-file
Resolves #109
2020-05-20 09:52:01 +01:00
rxi bc4bf3d384 Added core.set_active_view(); removed `focusable` boolean from View 2020-05-19 14:55:46 +01:00
rxi 8ec717f240 Added temporary backwards compatibility for `core.project_dir` 2020-05-18 10:28:01 +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 4644154e5b Added `config.ignore_files`
Filenames that match either the single pattern provided by
`config.ignore_files`, or any pattern in a table of patterns, will be ignored
when lite is filling the `core.project_files` table

Resolves #77
Resolves #102
2020-05-17 13:38:45 +01:00
rxi bc3147e1d0 Changed config.mouse_wheel_scroll default to multiply by SCALE 2020-05-16 09:46:31 +01:00
rxi 15129b49a6 Moved `config.treeview_size` from `config.lua` to `treeview.lua` 2020-05-16 09:44:31 +01:00
rxi b8d2805502 Exposed doc's internal insert/remove: Doc:raw_insert|remove 2020-05-14 16:40:50 +01:00
rxi ef53453246 Fixed x-offset of text in `DocView:draw_line_gutter` 2020-05-14 13:26:21 +01:00
rxi 6525269386 Made tokenizer skip parsing process on plain-text files
This, along with the earlier rencache changes should resolve #64
2020-05-14 10:10:50 +01:00
rxi bcd1b3a081 Fixed gutter text jittering when horizontal scrolling on docview 2020-05-14 10:06:47 +01:00
rxi e4ae088bb5 Added support for shift+click selecting
Resolves #71
Resolves #59
2020-05-13 16:12:20 +01:00
rxi 1f55fec94b Fixed triple-clicking on last line not selecting the line 2020-05-13 09:29:53 +01:00
rxi ed86f7d04e Fixed find-replace:select-next erroring on multiline selection 2020-05-12 20:05:17 +01:00
rxi 7f6a2710ef Made clicking the message on the StatusView open a LogView 2020-05-12 14:44:29 +01:00
rxi c215eff6d8 Improved idle CPU utilisation when not-focused, added system.wait_event() 2020-05-11 00:21:07 +01:00
rxi 543234c42e Removed redundant line from syntax highlighter 2020-05-10 09:20:06 +01:00
rxi 8671b02bdc Whitespace 2020-05-10 09:14:12 +01:00
rxi 3d49b6d200 Fixed highlighter resetting of syntax on doc filename change 2020-05-09 16:28:18 +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 ffdaec47e8 Default color theme adjustments 2020-05-09 11:10:19 +01:00
rxi 18b7d70a91 Fixed rare case where core.doc.highlighter would iterate out of line bounds 2020-05-09 09:09:39 +01:00
rxi a651d48e84 Wrapped `core.on_event` calls in `core.try` 2020-05-09 08:38:51 +01:00
rxi 22171fa802 Simplified core.step() 2020-05-08 20:44:53 +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
rxi bf8565d2a1 Fixed `doc:toggle-line-comments` for syntax highlighter relocation 2020-05-07 23:11:04 +01:00
rxi 95bdb07d49 Removed unused variables 2020-05-07 22:40:34 +01:00
rxi de94c8a13c Removed unused variables in core.init 2020-05-07 22:25:52 +01:00
rxi 762c1e2b69 Fixed RootView's EmptyView keymap text
Broke due to command renaming
2020-05-07 21:46:21 +01:00
rxi f5025efbb8 Moved highlighter code from `DocView` to `Doc`
* Only one highlighter state is kept per-document as opposed
  to one per-docview
* Fixes a bug with retaining older highlighter state as a
  DocView wasn't able to detect lines changing above it's viewport
* Renames `highlighter` module to more descriptive `tokenizer`
2020-05-07 21:14:46 +01:00
rxi ae42176953 Renamed `common.matches_pattern` => `common.match_pattern` 2020-05-07 14:18:46 +01:00
rxi 5acc391288 Added logging when project module is loaded 2020-05-07 13:41:39 +01:00
rxi 596b40c741 Made `find-replace:find-symbol` use first symbol in sel as default 2020-05-07 10:55:11 +01:00
rxi 3057786ce2 Moved `matches_pattern` from `syntax` to `common` 2020-05-07 10:27:37 +01:00
rxi 73996e3dc9 Changed core to store `modified` and `size` in project_files table 2020-05-06 17:03:10 +01:00
rxi 5361bfaf9c Added open-[project|user]-module commands, renamed command/file finder commands 2020-05-06 14:48:04 +01:00
rxi 271e5434d0 Added support for a `.lite_project.lua` file in project directory 2020-05-06 13:29:35 +01:00
rxi 7610e1064f Added multiline support for LogView's messages 2020-05-06 00:06:27 +01:00
rxi 15cfbfbc46 Increased config.max_log_items from 20 to 80 2020-05-05 23:40:42 +01:00
rxi 9bd6efddd7 Made separator and separator2 fields of StatusView 2020-05-03 22:44:49 +01:00
rxi d5ffee51ff Added StatusView:get_items() 2020-05-03 18:47:55 +01:00
rxi 844dced7cd Simplified StatusView item drawing 2020-05-03 18:43:24 +01:00
rxi d859ce5fcd Added mapping for `shift+delete` to keymap 2020-05-03 18:37:06 +01:00
rxi 69e6550eba Added mappings for `ctrl+delete` and `ctrl+shift+delete` to keymap 2020-05-03 18:35:16 +01:00
rxi 05ca43e637 Changed rounding type on common.draw_text() 2020-05-03 16:48:35 +01:00
rxi 0967740d88 Improved findreplace replace log and commandview text 2020-05-02 14:45:33 +01:00
rxi 5155ce0527 Added `replace-symbol` command to findreplace plugin 2020-05-02 11:14:07 +01:00
rxi 9fc185af2f Added scroll bounds
Resolves #9
Resolves #6
Resolves #3
2020-05-02 00:21:04 +01:00
rxi 28cdd3cabe Minor cleanup in core.statusview and core.commands.core 2020-05-01 20:17:10 +01:00
rxi 4ca35fe056 Added command `doc:select-none`, added binding to `escape` 2020-05-01 19:25:17 +01:00
rxi 885ed5f860 Improved handling of zero-sized locked nodes on RootView 2020-05-01 16:17:07 +01:00
rxi ab8510291e Added find-replace:select-next, bound to ctrl+d by default 2020-05-01 10:21:57 +01:00
rxi 044fdb3655 Prevented scroll-animation when LogView is initialized 2020-04-30 14:44:52 +01:00
rxi 4d39dcaded Changed `View:get_content_offset()` to round resultant values
Avoids some issues that occur with fractional offsets, most noticable
on rectangles drawn on DocView jittering by 1-pixel when scrolling
2020-04-30 14:43:25 +01:00
rxi 439537d63e Fixed format string passed to core.error() in core.try() 2020-04-26 21:40:25 +01:00
rxi accf09c4f9 Changed printed filenames to use format-specifier "%s" instead of %q
Fixes #22
2020-04-25 13:26:55 +01:00
rxi c658b6f1ca Removed underscore from start of globals, added VERSION
eg. `_SCALE` => `SCALE`
prevents conflict with lua's own _NAME globals
2020-04-25 09:58:01 +01:00
rxi 592c16f3e0 Fixed rounding of CommandView suggestion popup box 2020-04-22 19:25:47 +01:00
rxi 9a32a00c73 Made core.log/error store call location instead of view 2020-04-22 00:02:35 +01:00
rxi 59881f81a6 Fixed common.path_suggest() for system.list_dir() changes 2020-04-21 23:47:01 +01:00
rxi 73e96c2641 Made project_scan_thread() ignore directories it can't open
Should fix #30 and #7
2020-04-21 23:43:35 +01:00
rxi 4191cf2c08 Added `core.try` wrapping of function passed to `core.add_thread` 2020-04-21 23:23:34 +01:00
rxi b7ec7a6acf core.doc.translate comment fix 2020-04-21 23:15:43 +01:00
rxi 55d7fa58d0 Removed fake mouse-moved event on scroll change
This ends up causing more problems than it solves; Fixes #29
2020-04-19 17:21:27 +01:00
rxi 503d5101b5 Reorganising of DocView's draw functions
* Renamed `draw_line_body` => `draw_line_main`
* Renamed `draw_gutter_text` => `draw_line_gutter`
* Added `draw_line_text` for *just* the line text
2020-04-18 15:27:18 +01:00
rxi 7046bfca24 Made cut/copy no-op if there is no selection 2020-04-12 11:22:16 +01:00
rxi 1be7a32c6b Fixed error on setting active view when closing certain splits in RootView 2020-04-12 11:14:49 +01:00
rxi d4284edd5c Replaced system.set_fullscreen with system.set_window_mode
Solves #24
2020-04-07 18:49:11 +01:00
rxi efed38d59c Added system.set_fullscreen() and core:toggle-fullscreen command 2020-03-25 22:44:59 +00:00
rxi 764b43494e Moved .c, .lua and .md language syntaxes from core.syntax to plugins 2020-03-07 15:53:54 +00:00
rxi 42f7f81188 Added `union`, `short` and `long` keywords to .c syntax 2020-03-07 15:50:52 +00:00
rxi 33ad329f24 Changed DocView not to strip trailing `\n` character on line's final token 2020-02-05 20:09:58 +00:00
Sergei V. Rogachev 7e868e14e6 Fixed root:switch-to-* command
Before the fix navigation between nodes in the root
view was broken: the scale factor wasn't taken into
account. Switching in the right and down directions
was impossible for scale factors greater than one.
2020-02-01 17:56:47 +03:00
rxi 719262a416 Added missing `volatile` keyword to C syntax 2020-01-25 13:54:42 +00:00
rxi 3c59abba0b Made keymap treat `right alt` as `altgr` modkey 2019-12-29 16:32:04 +00:00
rxi 2c3e393a6f Changed keymap to only treat `left alt` as `alt` modkey
This prevents AltGr from being treated as the `alt` modkey. Previously
its default behaviour would have been overridden if the keymap had an
`alt+...` stroke bound
2019-12-29 16:09:56 +00:00
rxi d8c4bfa6ba Initial commit 2019-12-28 11:17:56 +00:00