Commit Graph

228 Commits

Author SHA1 Message Date
Francesco Abbate d086ae9ecb Update dmon.h with new macOS fixes 2021-10-03 00:00:20 +02:00
Francesco Abbate 66196d612c Fix in dmon.h for macOS path case sensitivity 2021-09-30 14:11:37 -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 e57d63e3a3 Update dmon from septag/dmon commit 74bbd93b
The new version includes fixes from jgmdev, github PR:

https://github.com/septag/dmon/pull/11

to solve incorrect behavior on linux not reporting directory creation.

Includes also a further revision from septag.
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 09d2c0a325 Update dmon from septag/dmon with fix for linux
Update from https://github.com/septag/dmon, commit: 48234fc2 to
include a fix for linux.
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 c9669410ad Fix macOS build issue with recent commit
Add objc_args in meson when compiling to pass C defines also to
bundle_open.m.

Default "bundle" option to false to have by default a unix-like
build and install.

In the run-local script always expect that "bundle" option is to
false to have a unix-like install.

In the build-package script pass the -Dbundle=true option when
building on macos.

When setting the resouce path revert to original method using

[[NSBundle mainBundle] resourcePath]

to have the real resource path when the bundle option will be
activated. With the recent commit the function
set_macos_bundle_resources will be called only if the "bundle"
option is activate and is not used in unix-like mode.
2021-08-19 14:33:39 -07:00
Francesco Abbate 717f4eb782 Conditionally disable macos bundle function 2021-08-19 11:33:03 +02:00
Francesco Abbate d9e73a97ea Merge remote-tracking branch 'harens/macos-bundle' 2021-08-19 11:32:36 +02:00
Nikolai Sinyov 1687bbd92d
Update main.c
Fixed interface Scale in MacOS in get_scale function
2021-08-19 10:07:46 +03: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
takase1121 35fd29fc39 remove extraneous DPI code
since 5 months ago (ttps://github.com/libsdl-org/SDL/commit/c289bad9007cb672c994f726d967f6e5682f200d)
SDL2 now reads Xft.dpi. There is no need to link to X11 anymore.
2021-08-17 07:53:44 -07: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 0777a6f0b8 Merged dev to master. 2021-07-20 14:39:50 -04:00
takase1121 c7bbf221ee remove duplicated constants 2021-07-15 18:01:24 -04:00
takase1121 192a93014d change double quotes to single quotes to reduce escaping 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
Adam 9126b5e64d
Merge pull request #313 from jgmdev/add-system-rmdir
Added `system.rmdir(path)`, and `common.rm(path, recursive)`
2021-06-29 17:44:58 -04: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
redtide df63775dca Use lite-xl as project and exacutable names 2021-06-25 22:54:02 +02:00
redtide 3f58e554ba Reorganization of data resources 2021-06-24 22:53:14 +02: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
lqdev 6195b246a5 ignore SIGPIPE from subprocesses spawned with reproc 2021-06-18 11:17:36 -04:00
Adam 804429e3b6
Merge pull request #266 from adamharrison/QuickOptimization
Replaced fill loop with SDL_FillRect.
2021-06-12 22:53:14 -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 214e6898df Reverted if guard. 2021-06-09 19:34:02 -04:00
Adam Harrison aa9f16c74c Added in #if guard for ARM achitectures. 2021-06-09 18:05:39 -04:00
Adam Harrison 29837d0c41 Replaced fill loop with SDL_FillRect. 2021-06-08 21:31:09 -04: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
Ferdinand Prantl 1eabf99054
Enable lite-xl to be started from a symlink to the deployed binary (#249)
Use resolved executablePath instead of resourcePath to allow lanching
the lite-xl binary via a symlink, like typically done by Homebrew:

/usr/local/bin/lite-xl -> /Applications/lite-xl.app/Contents/MacOS/lite-xl

The resourcePath returns /usr/local in this case instead of
/Applications/lite-xl.app/Contents/Resources, which makes later
access to the resource files fail. Resolving the symlink to the
executable and then the relative path to the expected directory
Resources is a workaround for starting the application from both
the launcher directly and the command line via the symlink.
2021-06-03 21:48:15 +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 4c99a18341 More accurate update rects / show window / present sequence
For the option when we use the SDL_Renderer we change:

- the order of calls to SDL_DestroyTexture/Renderer.
  Reported by valgrind on linux as an error to destroy the
  renderer before the texture.
- the SDL_Renderer and texture are created when the surface is
  initialized before the window is shown

It seems that creating the SDL_Renderer and Texture between the
moment the window was shown and the renderer present was introducing
a flashing blank window because of the time taken to create the
renderer/texture resources.
2021-05-06 09:00:36 +02:00
Francesco Abbate d8244120e9 Ensure the rencache commands buffer is cleared on restart
Fix issue #176 but it should be tested more thoroughly.
2021-05-05 09:32:24 +02:00
Francesco Abbate 3d84fe5488 Make usage of SDL renderer optional 2021-04-29 14:15:24 +02:00
Francesco Abbate 7c79105d2f Fix missing scaling for update rects in renderer 2021-04-27 07:29:13 -07:00
Francesco Abbate 9486940082 Update the whole texture with RenderCopy 2021-04-27 15:21:23 +02:00