Commit Graph

76 Commits

Author SHA1 Message Date
Francesco Abbate fb1e08840e Merge branch 'dmon-1' into dmon-debug 2021-09-30 14:24:50 -07:00
Francesco Abbate 4e58e8be28 Use new dmon version win watch_add/rm
Include changes in dmon not yet merged into master.
2021-09-29 14:08:05 +02:00
Francesco Abbate 494587954f More accurate path compare function 2021-09-29 14:08:05 +02:00
Francesco Abbate aa37f2b149 Fix several problem with directory update
When scanning a subdirectory on-demand ensure files aready present
are not added twice. Files or directory can be already present due
to dir monitoring create message.

Fix check for ignore files when adding a file to respond to a dir monitor
event to use each part of the file's path.

Fix C function to compare files for treeview placement.
2021-09-29 14:08:04 +02:00
Francesco Abbate e01f6fefe6 Treat watch dir errors and fix various things
Verity if dmon_watch returns an error.

Add a check if an added file for which we received a create event is
ignored based on the user's config.

Add some explanatory comments in the code.
2021-09-29 14:08:04 +02:00
Francesco Abbate 1ba385eb5e First integration of dmon for directory monitoring 2021-09-29 14:07:34 +02:00
Francesco Abbate 590c83148e Enable inotify specific api only on linux 2021-09-29 11:38:03 +02:00
Francesco Abbate c08b76746b WIP: temporary fix for testing 2021-09-21 23:50:50 +02:00
Francesco Abbate 794fd6b47b Add dmon_watch_rm function to remove subdir 2021-09-21 11:39:38 +02:00
Francesco Abbate 31eed0c61a WIP: using new dmon_watch_add function 2021-09-20 17:51:46 +02:00
Adam Harrison 0777a6f0b8 Merged dev to master. 2021-07-20 14:39:50 -04:00
Francesco Abbate aa9221e785 More accurate path compare function 2021-07-20 15:28:36 +02:00
takase1121 c7bbf221ee remove duplicated constants 2021-07-15 18:01:24 -04:00
takase1121 818e21610c do not terminate process when read fails 2021-07-15 18:01:24 -04:00
takase1121 de3013ce88 fix wrongly spaced variable name 2021-07-15 18:01:24 -04:00
takase1121 e7b025203b add generic read function
process_read and process_read_errors no longer contain redundant code
2021-07-15 18:01:24 -04:00
takase1121 8bbb26a469 refactor process.c
- include api.h instead of individual #includes
- moved metatable name to API_TYPE_PROCESS
- moved read buffer size to READ_BUF_SIZE
2021-07-15 18:01:24 -04:00
Francesco Abbate 8e7d3c0f66 Fix several problem with directory update
When scanning a subdirectory on-demand ensure files aready present
are not added twice. Files or directory can be already present due
to dir monitoring create message.

Fix check for ignore files when adding a file to respond to a dir monitor
event to use each part of the file's path.

Fix C function to compare files for treeview placement.
2021-07-15 18:49:18 +02:00
Francesco Abbate 3994c3ac42 Treat watch dir errors and fix various things
Verity if dmon_watch returns an error.

Add a check if an added file for which we received a create event is
ignored based on the user's config.

Add some explanatory comments in the code.
2021-07-15 09:56:49 +02:00
Francesco Abbate 79b65014a5 WIP: add correct binary search for removed file
Use a C function to compare nested files in project tree to enable
binary search of a file across the project files tree.
2021-07-13 22:23:52 +02:00
Francesco Abbate b2affddf32 WIP: advance implementation bot not yet complete
Now we request a watch on the directory and we manage sending
and receiving directory change events.

The mechanism to update on the fly the directory scan is not complete.
The code to remove a file is there but we need to implement the code
to add a new file.
2021-07-13 17:40:26 +02:00
Francesco Abbate 31199ecbfc WIP: integrating dmon for directory monitoring
Just integrating the file, adding initialization and some
stub code.
2021-07-12 18:21:27 +02:00
jgmdev 4188269cef Added system.rmdir(path)
It is reported that the built-in lua function os.remove(path) does
not removes empty directories on windows. To fix this a system.rmdir
function is introduced that calls a native win32 function.

Also common.rm(path, recursively) was added which wraps system.rmdir()
to easily delete an entire folder with all its contents.
2021-06-28 11:07:27 -04:00
Adam 83a604dfb7
Merge pull request #296 from lite-xl/font-copy-api
Add a C API copy method for font_desc objects
2021-06-24 12:47:16 -04:00
jgmdev 88704c6ecb [api/process] added missing fields and minor fix to pid() 2021-06-22 15:01:30 -04:00
Francesco Abbate 1cf0f2009c Add a C API copy method for font_desc objects
Add a renderer.font's method "copy" to clone the font object
by specifying an optional new size. In the size is not given
the size of the original object is used.

Should fulfill the request from issue #288.
2021-06-21 11:18:52 +02:00
jgmdev 5d2734de81 Merge reproc changes from dev. 2021-06-18 14:19:09 -04:00
Francesco Abbate 0f2ac136d0 Fix whitespace errors 2021-06-11 15:02:15 +02:00
Francesco Abbate 752ecd5ece Group mouse move events from C API function
Groups together consecutive mouse move events like done in core.step()
lua function but on the C side.

It does not introduce any meaningful speedup but it theory is more efficient and
simplifies the Lua code.

The simplification of the Lua code alone is enough to justify this change?
2021-06-11 15:00:18 +02:00
Adam Harrison 3b816a2b4a Changed regex error handling, so that errors can be handled gracefully in lua, and made it so gsub returns the exact matches and replacements. 2021-06-04 23:58:17 -04: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
Ferdinand Prantl d0adb748a6
Flush the SDL_QUIT event when Cmd+W is detected in SDL_KEYDOWN as well (#248)
On macos 11.2.3 with sdl 2.0.14 the keyup handler for cmd+w was not
enough. Maybe the quit event started to be triggered from the keydown
handler? In any case, flushing the quit event there too helped.
2021-06-03 22:14:50 +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
Francesco Abbate aa0b2bb5fc Fix crash problem with rencache and font access
In some cases rencache was using a FontDesc pointer that was actually freed by
Lua giving segfaults errors.

In addition, some FontDesc object were not freed in some cases if the
rencache_end_frame was not called when performing the "restart" command.

The invalid access problem can happen because rencache keep some pointers to
FontDesc object but these are Lua userdata that Lua can dispose of. This
situation is prone to hard errors and we should avoid to keep pointers to
objects managed by Lua.

To this purpose we use luaL_ref/unref to bind the FontDesc into the Lua's
registry while rencache need them. We still keeps pointer to FontDesc object but
using luaL_ref we are assured they will not be disposed by Lua.

Since we are using luaL_ref/unref to inform the GC about when the objects are in
use we can now finalize the objects directly when Lua collects them. Previously
the GC metamethods was issuing a FREE command to rencache and the font was
actually freed only from the rencache_end_frame function.
2021-05-21 23:38:54 +02:00
Adam c7b1a6f53e
Allowed for optional boolean to better match filenames. (#180) 2021-05-16 19:23:17 +02:00
Francesco Abbate 3d84fe5488 Make usage of SDL renderer optional 2021-04-29 14:15:24 +02:00
Francesco Abbate f2a33a567b Cleanup FontDesc struct and implementation 2021-04-26 15:56:18 +02:00
Francesco Abbate 46c3bdea67 First implementation of scaling for retina display
Introduce a new approach that discriminate coordinates in
points and pixels. Now all the logic from the Lua side and in
rencache is to always use points. The coordinates are converted
to pixels only within the renderer, in the file renderer.c.
In this way the application logic does not need to care about the
scaling of the retina displays.

For non-retina display the scaling between points and pixels is
equal to one so nothing will change.

There is nevertheless a change that leak into the Lua side. The
subpixel coordinates are in sub-pixel, not sub-points so they are
scaled by the retina scaling factor. But no change in the code is
required because the subpixel scaling factor take into account the
retina scaling, when present.

Because the retina scaling factor is not know when the application
starts but only when a window is actually available we introduce a
mechanism to render the font with a given scaling factor only from
the renderer when they are needed. We use therefore FontDesc to
describe the font information but without actually rasterizing the
font at a given scale.
2021-04-26 15:16:34 +02:00
Francesco Abbate 57e6de978b Fix error with missing ren_resize call 2021-04-23 07:09:50 -07:00
Francesco Abbate 33fe7295c0 First working implemention
Cleanup also debug messages
2021-04-23 14:54:25 +02:00
Francesco Abbate 1f6680b492 Add macos flush specific fix
Taken from @mathewmariani lite-macos
2021-04-21 09:51:40 +02:00
Francesco Abbate d5e9ef6bff Remove trailing debug message 2021-04-12 19:12:21 +02: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 46791aefe5 Implement maximize/restore controls
Remove also resize from top and right of the window
2021-04-12 11:54:52 +02:00
Francesco Abbate 67dc16ad26 Make windows control buttons active 2021-04-11 23:52:31 +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 b1c1deb4c4 Remove no longer used system.show_confirm_dialog
Replaced by the NagView dialog
2021-04-06 07:12:33 +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