Commit Graph

148 Commits

Author SHA1 Message Date
Francesco Abbate 78bb96cf72 Fix a few problems related to the rebase 2021-06-04 17:16:28 +02:00
Francesco Abbate 52325d20dd WIP: implement new project commands
Implement commands to load a project from a directory and integrate
the project module within the core modules replacing the workspace
plugin.

Needs polishing but the basic functionalities are there.
2021-06-04 16:32:25 +02:00
Francesco Abbate 9e29b90318 Add first commands to load/save projects 2021-06-04 16:28:17 +02:00
Francesco Abbate 89bb106d32 Improve code project filename resolution 2021-06-04 16:28:13 +02:00
Francesco Abbate 4621ee2e7f Accept relative filenames in command find-file
Use name within project entries to resolve filenames in
command find-file.
2021-06-04 16:26:18 +02:00
Francesco Abbate d84246c61d Fix application start for project-based approach 2021-06-04 16:26:16 +02:00
Francesco Abbate 82231dbc98 Fix a few more things about filenames 2021-06-04 16:26:14 +02:00
Francesco Abbate 2aac1b8179 Fix doc opening to use absolute filenames
Now we store doc.filename only and removed doc.abs_filename. The former
doc.filename is always the absolute filename.

We use now the variable core.working_dir to transform relative path into
absolute ones.
2021-06-04 16:26:11 +02:00
Francesco Abbate 0a53425381 WIP implementation of project-based schema
Roughly works but need more work and polishing. The workspace plugin
is temporarily disable waiting to be fixed.

Now the application does no longer 'chdir' into the project directory
and we removed the concept of project's directory (core.project_dir)
and project's files (core.project_files). Instead we have always a
project that can contain zero, one or many directories or files.
No directory is special within a project, there is no longer a concept
of project's directory.

WIP adapting open-file command to open a directory

Crash when adding a file into the project
2021-06-04 16:10:57 +02:00
Francesco Abbate 527b11029e Create new document if file doesn't exist
If a non-existing file is specified with the command "core:open-file"
a new document is opened with the given filename provided the directory
already exists.

The flag new_file is set to true in the Doc instance.

The file will be actually created only when the "save" command is used.

The document will be marked with the "*" event when no changes are done
to mean that it is a new file and is not yet saved.

The function common.normalize_path now process the .. and . in the
filename. Before was not needed because system.absolute_path already
get rid of them but now we need to have the absolute path of files
that not yet exists so we cannot use system.absolute_path.
2021-06-04 16:03:46 +02:00
Francesco Abbate 0d48f9e8b5 Remove duplicate normalize_path function
Use the function defined in the "common" module.

Move the check for not-nil filename from common.normalize_path
to core.open_doc. In this latter the filename can be nil if a
new unnamed document is created.
2021-06-04 16:01:28 +02:00
Francesco b046afccf9
Scale fonts context menu (#246)
* Retrieve scale plugin from lite-plugins

* New implementation of scale plugin and font C API

Introduce two new C API functions, renderer.font.get_size and set_size
respectively to get the font size and to set the size to a new value.

Using these functions we don't need to know the name of the font but
we can just change their size.

Adapt the scale plugin to use the new C API function with minor adaptations
in the logic.

Use smaller step to scale fonts.

Rename font_desc_free function, previous name was misleading as only the cached
resources are freed.

* Add contextmenu plugin from takase

From https://github.com/takase1121/lite-contextmenu

Adapted to show font scaling commands and find/replace commands.

i#	testing.lua

* Fix the cursor flickering with contextmenu

To avoid flickering of the cursor when using the context menu
we add a new function `core.request_cursor` that just take note
of the cursor requested.

The cursor will be actually changed only in root_view:draw() method
only when all the drawing operations are done. This means the cursor
will be changed only once per frame and only the most recent cursor
change request will take effect.

* Remove unneeded scale plugin return functions
2021-06-03 22:49:37 +02: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
Francesco Abbate 4e93eabbac Deprecate core.add_save_hook to override Doc:save
In order to stay simple and closer to the lite's design principles we
deprecate the core.add_save_hook function and the related mechanism.
Instead we now directly override the Doc:save() method.

The method is already overrided from core.init to add the automatic
reloading of style when user's module is saved.

The cleanup is related to the discussion in issue #229.
2021-05-31 09:41:37 +02:00
Francesco Abbate 6d044224c1 Starts maximized only if it was in previous session 2021-05-28 16:35:25 +02:00
redtide 818a7abb0a Avoid to restore window size when maximized (#226) 2021-05-28 08:51:39 +02:00
Francesco Abbate ad7d17caca Use FiraSans regular for UI 2021-05-27 13:49:33 +02:00
Janis-Leuenberger 1394c53dbc
Improve user feedback for big directories (#223) 2021-05-27 08:28:58 +02: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
Francesco Abbate 739763675e Check the real absolute path of user module
Close issue #212
2021-05-22 23:32:45 +02:00
Francesco Abbate 217360ed31 Switch to FiraSans and JetBrainsMono fonts 2021-05-22 15:09:54 +02:00
Francesco Abbate 5cef643e02 Introduce new plugin versioning tag mod-version
New plugins should use the version tag:

-- mod-version: 1

The old version tag "-- lite-xl 1.16" will be considerer equivalent
to mod-version 1.
2021-05-05 22:38:29 +02:00
Adam 135dfa6f03
Add a more explicit message in log and config.max_project_files
* Added a line to avoid people going down the rabbit hole that I did.

* Further explanatory text.
2021-05-05 16:00:17 +02:00
Francesco Abbate 1a05e00fdd Fix detection of user file module
Close #54
2021-05-01 19:27:29 +02:00
Francesco Abbate e6d88909a8 Fix log message about project dir 2021-05-01 19:27:29 +02:00
Francesco Abbate 5766329313 Fix filename problem
Close #163
2021-05-01 19:27:29 +02:00
lqdev c859498d68 check version in init.lua within directory plugins 2021-04-25 19:14:36 +02:00
lqdev 34e94bb8aa fixed versioning, again 2021-04-25 12:35:00 +02:00
lqdev 5e8e2f54b5 directories should not be loaded 2021-04-25 11:45:08 +02:00
Francesco Abbate 8bcace1d59 Merge remote-tracking branch 'origin/border-less-window' 2021-04-21 08:42:57 +02:00
Francesco Abbate 032018ec48 More aggressive wait_event timeout when window has focus
Adopt a time based logic for cursor blinking and wait for event

when idle with a timeout equal to blink remaining time.
2021-04-17 14:57:28 -07:00
Francesco Abbate f7375924ab Make non-borderless mode work 2021-04-12 19:05:30 +02:00
Francesco Abbate 4de97d51fb Avoid always calling system.get_window_mode 2021-04-12 13:31:32 +02:00
Francesco Abbate 8ad87d77da Add correct hit-test information and menu icon 2021-04-11 15:08:25 +02:00
Francesco Abbate 7531a0ddc8 Preliminary implementation of border-less mode
Not yet functional but most ingredients are there
2021-04-10 19:35:57 +02:00
Francesco Abbate f250adcda1 Implement multi-lines for NagView
Related to issue #147
2021-04-07 23:46:45 +02:00
Francesco Abbate 119f406d3c Add NagView message for refused plugins 2021-04-07 09:42:19 +02:00
Francesco Abbate d7cc1f9f9d Add plugin verification by version tag 2021-04-06 17:50:46 +02:00
Takase 63b9cf223e
NagView improvements (#136)
Implement keyboard commands for the NagView.
2021-04-04 16:11:47 +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 7f50df6a2f Ensure plugin within a directory are loaded
Close #118
2021-03-20 16:34:00 +01:00
Takase c0ad86de8c
integrate NagView 2021-03-13 12:57:52 +01:00
Francesco Abbate 23a053e1ee Ensure error and stack trace are written to stdout
To address https://github.com/franko/lite-xl/issues/87
2021-03-07 09:48:44 +01:00
Francesco Abbate 09332fe242 Fix problem with fatal error message
Previous implementation was broken.

Ensure the error file is always written and write its location in the error message
2021-03-05 23:46:41 +01:00
Francesco Abbate a4bc8986ff Implement fatal error message box
Used when lite-xl fails at startup
2021-03-05 10:33:50 +01:00
Francesco Abbate 3506ff47fc Fix problem with plugin loading
Introduced with PR https://github.com/franko/lite-xl/pull/73
2021-03-05 07:22:56 +01:00
liquidev 2e1a6ad5d1
Fix #30 – user plugins take priority over built-in plugins (#73)
user plugins should take priority over stock plugins
2021-03-03 12:20:22 +01:00
Francesco Abbate 8883685eea Fix font size in initial user's config 2021-03-01 09:48:12 +01:00
Francesco Abbate a35ef764a0 Show Lite XL instead of lite in window's title 2021-02-28 18:55:05 +01:00