Commit Graph

444 Commits

Author SHA1 Message Date
Guldoman e7a575b4c4
Use relative mouse position directly for drop event (#1140)
Previously the relative position was calculated using the window 
position and the global mouse coordinates. In some systems like wayland, 
this operation returns incorrect values.
2022-10-09 20:13:51 -04:00
Adam e34a3ca78f Stealthy fix of list_dir on windows with single letter directories. 2022-10-04 21:06:23 -04:00
Adam 293110feaa
Fix process api detach bug (#1137)
* Added in conditional, as detaching will fail with "Operation not permitted" on linux; setsid sets a new process group anyway.

* Added in variable to check detached state on cleanup, so we don't send TERM.
2022-10-04 20:02:22 -04:00
Jan 630ab0ab92
Add i386 architecture detection, add FreeBSD to platform detection (#1135)
defining anything that isn't a specific set of architectures x86 is just wrong.
It should at least be called something non identifying like "native"

Lite-XL already builds for FreeBSD so add it to the platform detection
2022-10-04 11:13:21 -04:00
Jefferson González ba0a454c97
system: added raise_window() (#1131) 2022-09-29 11:31:55 -04:00
Jefferson González a640360d0d
api: expose api_load_libs to native plugins (#1125)
This function is currently needed for the threading plugin.
2022-09-22 20:30:24 -04:00
Dmitry Atamanov 4546ce13e4
Update unidata to version 15.0 (#1122) 2022-09-19 21:27:54 -04:00
Adam 5ada80b9df
Added in native modules suffixes. (#1111)
* Added in native modules with suffixes, giving priority to those with matching architectures and platforms.

* PowerPC isn't x86, and it's x86_64.

* Changed things over to allow compiler to set a tuple, makes more sense from a build perspective.

* Spelling mistake.

* Added in arm target tuples.
2022-09-18 18:27:50 -04:00
Adam 4f17667d42 Changed setpgrp to a more portable form. 2022-09-02 20:26:13 -04:00
Guldoman cbe0fd63bf
Reduce double click radius
SDL uses 32 pixels by default, which is a bit too much and causes 
problems with, for example, adding multiple close selections too 
quickly.
2022-08-21 19:08:32 +02:00
Aqil Contractor 9b1bfeacac
Added a smoothing and strikethrough option to font loading. (#1087)
* Added a smoothing option to font loading.
* Added a font strikethrough option to font loading.
* Fixed underline applying incorrectly in cases of non-underlined fallback fonts being used.

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
2022-08-20 16:15:08 -04:00
Guldoman 86024586fd
Start dirmonitor check thread only after a watch is added (#1072) 2022-07-11 17:14:50 -04:00
Adam e784513222 Missing header. 2022-06-24 20:21:15 -04:00
jgmdev d2f9eeea07 renderer fonts: additions and improvements
* Allow passing font options to renderer.font:copy().
* Added renderer.font:get_path()
* Reintroduced set_size() for more faster font size changes
* Swapped copy wiht set_size on scale plugin for better performance
* Use code_font:copy() instead of renderer.font.load() on language_md to
  properly match user font now that font options are supported on copy.
* Added new changes to renderer docs
2022-06-23 18:08:04 -04:00
Adam d48fa9ef74 Fixed minor issue on windows. 2022-06-23 17:43:49 -04:00
Takase 4e1ce07610
make system.* functions support UTF8 filenames (#1042)
* make system.* functions support UTF8 filenames
* move utfconv.h into ifdef guard
* fix wrong null check
2022-06-17 09:31:52 -04:00
Jefferson González bde056350a
Merge pull request #1037 from takase1121/PR/dlopen-omit-filename
omit filename when printing error for library load
2022-06-15 16:37:41 -04:00
takase1121 7ecc174094
fix memory leak and wrong check in font_retrieve 2022-06-15 23:23:13 +08:00
takase1121 0de90d542b
omit filename from error message 2022-06-15 16:05:20 +08:00
takase1121 73cd768a19
load space metrics only instead of all metrics of the 1st 256 characters 2022-06-12 08:22:01 +08:00
jgmdev 83f368cdbe core: check for sdl initialization errors 2022-05-31 14:57:26 -04:00
Guldoman 74f7389cac
Make regex API return integers 2022-05-28 01:20:41 +02:00
takase1121 3bd679da12 make lite-xl respect the taskbar and allow aero-drop in borderless mode 2022-05-23 13:10:11 +08:00
jgmdev b9bb64a2f0 Merge branch 'master' into master-2.1 2022-05-22 22:26:47 -04:00
Adam Harrison daeb2a8e04 Made sure we redrew things, added in a contingency in 'save' for times when we load a non-existent file, and added some checks. 2022-05-15 15:25:02 -04:00
Adam 36c4d5d9ed
Autoreload Nagview (#942)
* Modified autoreload to use new dirwatch infrastructure, and added in nagview to verify that fs changes don't stomp on our changes, unless you want them to.

* Split out reload functionality to actual document, and added in a thread to check the document, in the cases where it wouldn't be covered by dirwatch.

* As per request from jgmdev, added in ability to show nagview always.

* Changed things over to use dirwatch.

* Made sure we redrew things, added in a contingency in 'save' for times when we load a non-existent file, and added some checks.
2022-05-15 15:21:26 -04:00
jgmdev 359880e963 c core: fix extra utf8 build conflict on windows 2022-05-11 00:22:01 -04:00
Adam Harrison 0315d397bd Removed undefined behaviour by using `poll` over `select`. 2022-05-09 23:12:43 -04:00
Adam 6229f74ccd
Merge branch 'master' into master-2.1 2022-05-09 21:36:10 -04:00
Adam Harrison ddc3a8842b Fixed dirwatch dummy, and scanning. 2022-05-09 21:30:13 -04:00
Guldoman 8156836126 Fix `ren_font_group_get_tab_size` returning unexpected values
We were casting the `xadvance` to an int, so in some cases the resulting 
tab size was wrong.
2022-05-04 10:26:48 -04:00
Adam Harrison 94abf66444 Fixed minor race condition. 2022-05-02 22:36:54 -04:00
Adam Harrison 91797d65d1 Fixed minor race condition. 2022-05-02 22:35:21 -04:00
Guldoman 9de75988ba
Send `mouseleft` event when the mouse leaves the window (#928)
* Send `mouseleft` event when the mouse leaves the window

* Call `View:on_mouse_left` when the mouse leaves the `View`

Previously `View:on_mouse_left` was called only when the mouse left the
window, and it was called on every visible `View`.

Now it gets also called when the mouse "changes" `View`, and only the
last `View` the mouse was on will receive the event.
2022-04-28 21:50:34 -04:00
Adam Harrison 9f7c6974ae Make sure pipes are closed on exec. 2022-04-26 12:14:38 -04:00
Adam 4bf4851736 Asynchronous Reads for Dirmonitor (#930)
Change dirmonitor reads to be synchronous, in a secondary thread.
2022-04-26 12:13:39 -04:00
Adam Harrison 6f65168b0d Fixed windows dirmonitor issues. 2022-04-26 12:04:41 -04:00
Jefferson González e572c58f24
Add utf8 support to tokenizer (#945)
* add utf8 support to tokenizer

* wrap utf8 functions in string table using a 'u' prefix

* document new utf8 functions
2022-04-26 09:42:02 -04:00
Guldoman 7dd83bb737
Fix `ren_font_group_get_tab_size` returning unexpected values
We were casting the `xadvance` to an int, so in some cases the resulting 
tab size was wrong.
2022-04-26 04:34:18 +02:00
Adam Harrison d8f202e251 Make sure pipes are closed on exec. 2022-04-24 21:13:18 -04:00
Adam 5df1640595
Merge branch 'master' into master-2.1 2022-04-24 13:42:24 -04:00
Adam 97174706fe
Asynchronous Reads for Dirmonitor (#930)
Change dirmonitor reads to be synchronous, in a secondary thread.
2022-04-24 13:40:58 -04:00
Guldoman 1439b59d65
Improve performance of `ren_draw_rect` (#935)
We color a 1x1 `SDL_Surface` with the desired color. This surface is 
then stretched over the area we need to cover using `SDL_BlitScaled`.
This way we avoid having to do the blending ourselves.
2022-04-20 17:13:42 -04:00
Jan fff10a2612
Cleanup (#826)
* Update meson.build
- add logic to loop over more lua names (in the future more names might be discovered)
- disable warnings and errors on dependencies

* adding missing includes and checks, correct data types, pointer mess […]
- various functions from string.h were used but never defined
- logic was done across multiple different data types with different signedness, got all of them up to snuff
- give 0 sized array size of 1 (array of size 0 is illegal, but rewriting the code is out of the scope of this commit)
- add preprocessor that marks possibly unused argument as such (does not mean they will get optimized out or anything)
- correctly initialize structs with all data needed

All these were found by generating the project using `meson -Dwarning_level=3 -Dwerror=true`

* remove undefined behavior, correct data types

* Comment manual bit manipulation to be investigated

* check for more edge cases, replace multiple cleanups with goto

* remove system specific includes
2022-04-15 11:34:46 -04:00
Adam 683d23e3ba
Changed calculation to use ascender, which should work better. (#912) 2022-04-04 10:38:43 -04:00
Adam Harrison 974fd9c8d5 Fixed windows dirmonitor issues. 2022-04-03 16:44:02 -04:00
Jan 120c769e7e
seperate dirmonitor logic, add build time detection of features (#866)
this also adds libkqueue support
2022-03-17 13:43:01 -04:00
Adam 960b482061
Fixed some issues with inotify and multiple events at the same time. (#872)
* Fixed some issues with inotify and multiple events at the same time. Seems to be working now.

* Cleaned up and simplified function, and commented, and fixed a number of bugs.

* Simplifying and fixing further.

* Improved performance for skipping large amounts of files.

* Added in extra checks, and changed paths. We should probably unify these path styles.

* Fixed stutter.

* Removed extraneous functions.

* Cleaned up more, added more testing; dealt with multiple sequential events correctly.
2022-03-08 19:30:25 -05:00
Guldoman 5714da81f8
Always check if the beginning of the text needs to be clipped 2022-03-07 23:35:56 +01:00
Adam f85612e0f0
Fix Project Scanning (#746)
Removed dmon, and replaced with logic that works across Linux, Mac, FreeBSD and Windows. Have tested on all platforms, and seems to work.

Co-authored-by: Jan200101 <sentrycraft123@gmail.com>
2022-03-06 00:59:22 -05:00
Guldoman fbb893c6b1
Fix `^` regex matching when using an offset
Before, if `offset > 1` was used, the match would have failed because 
the beginning of the string was never met.

Now we force the beginning of the string to be the one specified by the 
offset.
2022-03-03 22:09:48 +01:00
Adam 61e712db12
Fixed rendering computations for y offset. (#843)
* Fixed rendering computations for y offset.

* Force monospacing if every ascii character has the same integer advance.

* Added in explanatory comment.

* Fixed issues.

* Made lines less long.
2022-02-15 15:57:07 -05:00
Adam 3a0af6ee04
Merge pull request #828 from adamharrison/signal-processes
Changed signalling so it'll target the whole process group.
2022-02-11 12:01:53 -05:00
Guldoman d4b8155cbc
Update process status when calling `process:running` 2022-02-08 18:10:54 +01:00
jgmdev df0635ad35 Implemented system.get_process_id() 2022-02-03 22:20:42 -04:00
Guldoman 9a6cd2b453
Use SDL to manage color format mapping in `ren_draw_rect` 2022-02-03 01:50:43 +01:00
Adam Harrison d2d5617774 Changed signalling so it'll target the whole process group. 2022-01-30 20:51:30 -05:00
Adam Harrison af76f544be Fixing performance regression. Due to the way the hashes work, we must 0 out the whole thing. 2022-01-29 15:19:22 -05:00
Adam 3d40725b8f
Merge pull request #816 from adamharrison/fix-process-api
Fixing up Process API
2022-01-28 23:53:37 -05:00
Adam Harrison 941523868e Merge branch 'fix-process-api' of github.com:adamharrison/lite-xl into fix-process-api 2022-01-28 15:44:16 -05:00
Adam Harrison 3773a812bd Incorporate realtakase's suggestions. 2022-01-28 15:39:57 -05:00
Adam 0a70b13a73
Merge pull request #809 from lite-xl/merge-master-2.0
Merge master 2.0
2022-01-28 14:38:22 -05:00
Adam Harrison f9ad83e53e Fixed windows not converting utf8 environment block to utf16. 2022-01-22 13:34:47 -05:00
Adam Harrison ed4128bc65 Added in support for env on linux. 2022-01-22 12:36:30 -05:00
Adam Harrison 428c757a13 Implemented @guldoman's suggestion for how to close file handles. 2022-01-22 12:02:59 -05:00
takase1121 f24ebf853d
fix invalid memory access 2022-01-22 23:30:48 +08:00
Francesco Abbate f6a0e12e31 Merge branch 'master-2.0' 2022-01-19 20:31:33 +01:00
Jan200101 192c577966
Add fallbacks to all common dependencies 2022-01-15 00:53:46 +01:00
Francesco Abbate ae1890d29a Fix project files reading with symlink 2022-01-12 00:32:10 +01:00
Francesco Abbate 44a8dc320b Fix some errors with previous commits 2022-01-09 23:26:11 +01:00
Francesco Abbate f0aea5b1a4 Report error codes from dmon_watch_add 2022-01-09 23:26:11 +01:00
Francesco Abbate 1520c12580 Remove DMON_LOG_ERROR to return an error code 2022-01-09 23:26:11 +01:00
Adam Harrison 31d448971a Restored floating point time granularity. 2022-01-08 12:59:15 -05:00
Jan200101 99ddf1fb92
Migrate to Lua 5.4 2021-12-31 13:53:01 +01:00
Francesco Abbate adaf023541 Always watch/unwatch subdirectories on all systems
Simplifies and uniformize the logic on the Lua side for the
setting of directories' watches. Now we always use the methods:

systems.watch_dir_add / rm

on all the project's directories at any depth when we are not
in files limit mode.

In files limited mode the functions systems.watch_dir_add/rm are
called only on the expanded folders. The shown_subdir table is also
updated only in files limited mode.

On the C side, using the dmon library, we remove the recursive argument
from the system.watch_dir and we always call it recursively except on
Linux. At the same time the functions:

systems.watch_dir_add / rm

are provided but as dummy functions that does nothing except on Linux
where they work as before to add / remove sub-directories in the inotify
watch.

In this was on the Lua side we always act we if the watches needed to be
set for each sub-directory explicitly, independently of the system.

The important improvement introduced is that we always avoid calling
dmon_watch recursively on Linux. This latter thing is problematic with
inotify and is therefore avoided on Linux.

On the other side we simplifies the logic on the Lua side and remove
conditions based on the OS used.
2021-12-30 15:25:27 +01:00
takase1121 84a3906323
fix FontGroup __gc method 2021-12-24 15:04:52 +08:00
Guldoman a122d7e916
Correct `get_key_name` comment 2021-12-23 00:06:24 +01:00
Jipok 773a85cd2d Support for remaped special keys(Fix #757) 2021-12-22 02:22:34 +05:00
Francesco Abbate 3109263c5d Call dmon_unwatch when changing project
Fix a conspicuous omission to call the dmon_unwatch function
when changing project directory.

This uncovered a bug or a quirk of the dmon library where the watch_ids
can change as a result of calling dmon_unwatch because they are just
indexes on a contiguous array. Use a workaround to always unwatch the
first valid watch_id N times.
2021-12-20 14:42:48 +01:00
Adam Harrison cb13afd749 Changed operator to be more correct for utf8. 2021-12-18 15:11:50 -05:00
Adam Harrison b4384eb49d Added in @Jipok's comment. 2021-12-18 15:09:00 -05:00
Adam baf43084b6
Merge pull request #745 from Jipok/keycode_fix
Correct definition of the pressed key for different layouts and languages
2021-12-18 14:55:14 -05:00
Jipok a8f7e9a35e Correct definition of the pressed key for different layouts and languages 2021-12-19 00:24:28 +05:00
Adam Harrison eb9918089a Takes kivutar's changes into account, cleaning things up slightly. 2021-12-15 20:31:24 -05:00
Adam f1054b8280
Replace Reproc (#535)
Replace reproc with simpler non-dependency-based process API.
2021-12-11 15:25:35 -05:00
Jipok c3b7234315 Keyboard layout independent shortcuts 2021-12-11 23:42:15 +05:00
Adam 8120654c59
Merge branch 'master' into plugin_api_h_fix 2021-12-05 22:11:47 -05:00
takase1121 aff1261b08
move NULL check to import side 2021-12-01 20:42:49 +08:00
Adam d7b6fe3d42
Merge pull request #688 from adamharrison/mono-font
Add Support for `none` Antialiasing
2021-11-23 15:59:07 -05:00
Adam Harrison 96db380c73 Manual merge of into . 2021-11-23 15:57:22 -05:00
Adam Harrison bc5be3c9b7 Support no antialiasing. 2021-11-22 18:13:43 -05:00
takase1121 b42f48782b
revert system.c
do not generate the exported symbols with the script
2021-11-17 08:58:44 +08:00
Adam Harrison 6750ddca2a Changed name of x1 and x2 to x and y. 2021-11-14 15:46:33 -05:00
Adam Harrison ce2ec9f442 Moved commands out to the outer event loop. 2021-11-14 15:41:28 -05:00
Adam 0db3648966
Merge pull request #660 from adamharrison/improved-heuristic
Improved heuristic to pay more attention to string length.
2021-11-12 17:47:46 -05:00
takase1121 68eb6810d9
update headers 2021-11-08 12:18:13 +08:00
Adam 4e26a9fb2d
Merge pull request #621 from adamharrison/fix-renderer-mappings
Handles occasions where our color bytes aren't in the order we expected.
2021-11-07 15:30:57 -05:00
Adam Harrison 934f9c05d4 Screwed up checks. 2021-11-07 15:01:03 -05:00
Adam Harrison a184ec9cc3 Improved heuristic to pay more attention to string length. 2021-11-07 14:04:42 -05:00
takase1121 e785bbf1bf
update generated headers 2021-11-06 20:39:10 +08:00