Commit Graph

1389 Commits

Author SHA1 Message Date
ThaCuber 9615ead41b
Text overwriting (#1495)
* added text overwriting

* rewrote `DocView:draw_caret` to not use the order of draws

* forgot to delete some old code in `DocView:draw_overlay`
also added a temporary solution to overwriting
and added the missing arguments in `DocView:draw_ime_decoration`
and fixed `DocView:draw_caret`

* accidentally broke the `draw_caret` call in `draw_overlay` in the process

* multiline

* fixed calling `Doc:get_char` as a function
that, in turn, crashed the editor because "can't index a number"

* move and rename some stuff

* remove unneeded extra check

I just had to change the `~=` to `<` in the second condition

* overwrite disregards pasting text

* disregard overwrite on selections; doc only removes selection

* Fixed error where `doc` was used, instead of `self`.

---------

Co-authored-by: ThaCuber <70547062+ThaCuber@users.noreply.github.com>
Co-authored-by: Adam Harrison <adamdharrison@gmail.com>
2023-11-29 14:12:43 -05:00
Guldoman e95094f0ca
Fix patterns starting with `^` in `tokenizer` (#1645)
Previously the "dirty" version of the pattern was used, which could 
result in trying to match with multiple `^`, which failed valid matches.
2023-11-29 11:11:46 -05:00
Guldoman 1c10bb894d
Fix `language_js` regex constant detection (#1581)
* Fix `language_js` regex constant detection

* Simplify regex constant detection in `language_js`

* Add more possessive quantifiers in `language_js` regex constant detection

This avoids more catastrophic backtracking cases.

* Allow `.` after regex constant in `language_js`
2023-11-29 11:00:09 -05:00
Guldoman f457bc33fa
Fix editing after undo not clearing the change id (#1574) 2023-11-29 10:45:53 -05:00
Guldoman 5532b52ad8
Fix selecting newlines with `find-replace:select-add-{next,all}` (#1608)
* Avoid adding existing selections in `select_add_next`

* Use the first available selection as delimiter in `select_add_next`

* Fix returning searches with newlines in `search.find`

* Fix repeat search when the last result spanned multiple lines
2023-11-29 10:40:47 -05:00
Guldoman ee93c3b08a
Fix `core.redraw` when window is not focused (#1601)
* Execute at least one step when window has no focus

This way if `core.redraw` is set, it's respected.

* Fully run threads at least once when window has no focus

This allows threads that set `core.redraw` (like `projectsearch`) to 
continue running even after the window loses focus.

"Fully" here means that `run_threads` has gone through *all* the "timed 
out" coroutines at least once.
2023-11-29 10:33:34 -05:00
Guldoman baa0c16e4d
Fix `dirmonitor` sorting issues (#1599)
* Use `PATHSEP` in path-related functions

* Don't stop on digits when getting the common part in `system.path_compare`

* Avoid sorting multiple times in `dirwatch.get_directory_files`

This also fixes the timeout detection in `recurse_pred`.
2023-11-29 09:55:38 -05:00
Guldoman dd75e676bc Fix running `core.step` when receiving an event while not waiting
When `time_to_wake` was <= 0, so when a coroutine needed to be executed 
as soon as possible, we didn't check for events, so we only performed a 
`core.step` with the blink timer.
This resulted in jerky reactions to input.
2023-11-29 09:11:39 +08:00
Daniel Margarido 55a19cd398
Fixed issue with set_target_size passing the wrong value to plugins (#1657)
* Fixed issue with set_target_size passing the wrong value to plugins that are split on the right and activated from the settings UI.

* Added position awareness for the all resize_child_node calls.
2023-11-29 07:34:44 +08:00
Guldoman 921dba3243
Fix deleting indentation with multiple cursors (#1670) 2023-11-28 20:54:11 +01:00
Guldoman 954f60b5f8
Avoid considering single spaces in `detectindent` (#1595) 2023-11-28 20:54:00 +01:00
ThaCuber f4b7cb584f
ease transparency of nagbar dim (#1658)
* ease transparency of nagbar dim

* tiny changes

* lerp alpha rather than the whole color
2023-10-31 16:24:36 -04:00
Guldoman e67ac2818f
Sanitize tab index in `Node:add_view` (#1651)
* Fix `Node:add_view` not adjusting tab index after removing `EmptyView`

* Clamp tab index in `Node:add_view`
2023-10-23 17:58:02 -04:00
Takase 1620a92d54
fix(dirmonitor): deadlock if error handler jumps somewhere else (#1647)
* fix: deadlock if error handler jumps somewhere else

* docs(dirmonitor): fix wrong data type in error callback

* docs(dirmonitor): clarify coroutines and deadlocks

* docs(dirmonitor): wording

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>

---------

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
2023-10-21 19:17:49 +02:00
Guldoman 9c6c5475d1
Save in the `workspace` unsaved named files and `crlf` status (#1597)
* Save in the `workspace` unsaved named files

* Save in the `workspace` the `crlf` status and restore it for "new" files
2023-10-18 06:46:58 +02:00
Guldoman 8ccdcb7820
Ignore keypresses during IME composition (#1573)
Some IMEs continue sending keypresses even during composition, so we 
just ignore them.
2023-10-18 06:46:27 +02:00
Guldoman cca1c798d2
Improve `common.serialize` (#1640)
* Make `common.serialize` more locale-independent

* Handle inf/nan numbers in `common.serialize`
2023-10-18 06:45:52 +02:00
Guldoman f69f43c3f5
Mark unsaved named files as dirty (#1598) 2023-10-18 06:45:31 +02:00
Guldoman 57dffbaf2a
Remove DPI detection for default `SCALE`
This often leads to `SCALE` values that are way off, and makes Lite XL 
unusable, so we now just default it to 1.
2023-09-30 16:48:38 +02:00
Guldoman b4e95b865c
Make `linewrapping` consider the expanded `Scrollbar` size
This avoids reflowing the text when hovering the scrollbar.
2023-09-07 04:07:52 +02:00
Guldoman 7e44162101
Fix `Scrollbar.{expanded,contracted}_size` documentation 2023-09-07 04:07:52 +02:00
Robert Hildebrandt 185b9cb080
Fixed C++14 digit separators (#1593) 2023-09-07 01:54:52 +02:00
Takase ac5c65c521
docs(core.config): add documentation for config options (#1512)
* docs(core.config): add documentation for config options

* docs(core.config): remove wrong newline

* docs(core.config): remove trailing whitespace

* docs(core.config): add missing whitespace

* docs(core.config): add disclaimer for core.file_size_limit

* docs(core.config): fix wrong description of the pattern

* docs(core.config): fix wrong description

* docs(core.config): fix wrong description for transitions

* docs(core.config): guide user to drawwhitespace plugin

* docs(core.config): clarify libdecor usage

* docs(core.config): clarify various things

* docs(core.config): clarify more about libdecor support

* docs(core.config): fix missing enum separator

* docs(core.config): remove wayland-specific advice on config.borderless
2023-08-26 11:32:39 -04:00
sammyette 5f68e8b7a9
feat(statusview): make a separate item for doc position percent (#1579)
* feat(statusview): make a separate item for doc position percent

* chore: remove unused variable

* fix(statusview): remove command for percent doc item

* fix(statusview): change doc percent tooltip

* fix(statusview): change percent tooltip message
2023-08-26 11:19:12 -04:00
Jefferson González 215b8daef7
Autocomplete plugin improvements (#1519)
* Add icons support to autocomplete plugin

* Removed redundant flag check

* Added support for non syntax colors

* Assert if color name not in style.syntax

* Autocomplete plugin improvements

* Support suggestion symbols scoping
  - global: all open documents
  - local: current document
  - related: all open documents with same syntax
  - none: language syntax symbols only
* Register style.syntax[] entries as icons
* Other related fixes
2023-08-26 10:50:48 -04:00
Guldoman 3f28557aeb
Add `NaN` guard to `View:update_scrollbar` 2023-08-26 05:11:33 +02:00
Adam cb66d5b9e7
Adds super as a modkey. (#1590)
* Adds super as a modkey.

* Added in super designation for windows.
2023-08-25 14:34:51 -04:00
Guldoman 671c8976df
Normalize strokes in fixed order (#1572)
* Use normalized strokes when removing duplicates only when appropriate

* Use normalized stroke in `keymap.unbind`

* Normalize strokes by sorting the modifiers before the keys

This also sorts the modifiers in a fixed manner, decided by 
`modkeys.keys`.
We need to do this because we display the strokes in a few places like 
the command palette.
2023-08-25 14:03:23 -04:00
Takase cb667af756
docs(core.contextmenu): add documentation for contextmenu (#1567) 2023-08-24 22:32:07 -04:00
Guldoman 0dc6043dc7
Fix returned `percent` when clicking the `Scrollbar` `track` 2023-08-23 19:07:52 +02:00
Guldoman d1c3fc0f1c
Fix `scrollbar` misinterpreting `percent` (#1587) 2023-08-20 10:28:49 -04:00
Takase 6d090625f8
fix(core): defer core:open-log until everything is loaded (#1585)
* fix(core): defer core:open-log until everything is loaded

* docs(core): document why core:open-log is opened in a thread
2023-08-18 09:25:10 -04:00
Guldoman 22544b6814
Make `DocView` aware of scrollbars sizes (#1177)
* Make `DocView:scroll_to_make_visible` aware of vertical scrollbar width

* Make `DocView` aware of horizontal scrollbar size
2023-08-04 10:56:49 -04:00
Guldoman e468545bf1
Use proper timeouts for coroutines that don't need to wait (#1467) 2023-08-04 09:40:02 -04:00
Delta-official bfc4892c98
Normalize stroke before adding keybind (#1334)
* Normalize stroke before adding keybind

* improve normalization algorithm and implement normalization in several functions

Signed-off-by: delta <darkussdelta@gmail.com>

---------

Signed-off-by: delta <darkussdelta@gmail.com>
2023-08-04 09:38:33 -04:00
Adam 43c73ca298
Fixed things for when a thread requests a redraw. (#1570)
* Fixed things for when a thread requests a redraw.

* @guldoman's changes.

* Whoops.
2023-08-01 21:38:24 +02:00
Takase 7955fa1d36
Documentation for core.command (#1564)
* docs(core.command): add documentation

* fix(core.common): fix warnings

* docs(core.command): add "core." prefix to all custom types

* docs(core.command); add name as parameter to command.perform

* docs(core.command): fix typo and wording

* docs(core.command): add disclaimer to command.generate_predicate

* docs(core.command): fix wording for predicate

* docs(core.command): document command name

* docs(core.command): document the always_true predicate
2023-07-27 13:04:44 +02:00
Takase 7b330ae81b
Documentation for core.common (#1510)
* docs(core.common): add and improve documentation

* refactor(core.common): remove unused variable to get_height()

* docs(core.common): remove messy newlines

* docs(core.common): fix wording

* docs(core.common): use integer instead of number

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>

* docs(core.common): update docs

the docs now follow the style in docs/ directory.
some of the changes suggested are also implemented.

* docs(core.common): fix typo

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>

* docs(core.common): restyle annoatations

Extra whitespaces are removed and @overload is used whenever possible.

* docs(core.common): fix various documentation errors

* docs(core.common): simplify unicode description

* docs(core.common): fix return value

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>

* docs(core.common): clarify common.bench for not being a benchmark

* docs(common): add disclaimer for numbers in common.serialize

---------

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
2023-07-22 21:39:32 +02:00
Adam 82fa9bc363
Updated extension for mac. (#1563) 2023-07-20 03:06:18 +02:00
Guldoman 96d6d9acac
Return state when tokenizing plaintext syntaxes 2023-07-09 18:59:25 +02:00
Guldoman 2767ac3718
Skip checking `files` if no filename was provided to `syntax.get` 2023-07-03 22:39:54 +02:00
Luke aka SwissalpS cfcd8af373
Fix #1538 log scrolls automatically (the real PR) (#1546)
* fix #1538 log scrolls automatically

adds:
- when user scrolls, position is kept no matter how many new entries
arrive
- when user scrolls up to last entry, autoscroll is enabled again

does not add buttons to jump up/down
see #1538

* move scroll-test out of on_mouse_wheel

* determine diff_index with loop

* remove check at move_towards yoffset

* use while loop instead of repeat loop

* remove meaningless setter

* remove stray var
2023-06-28 03:05:03 +02:00
Luke aka SwissalpS cf028c510a
comment typo in object.lua (#1541) 2023-06-25 04:09:27 +02:00
Jan 0075b060c8
Add top tab margins (#1479)
adapted from #810 to allow styles to decide upon the top margin of the tab list
2023-06-09 09:44:20 -04:00
Guldoman daaf247ad9
Show cursor at the start of the next line when selecting full lines (#761)
This was the previous behavior that regressed with the keymap clicks.

This also better shows that the selection extends to the next line.
2023-06-09 09:37:08 -04:00
Guldoman 595196f4fa
Make `Doc:sanitize_position` return a more appropriate `col` (#1469)
If `line` is out of range, return the `col` "closest" to the original
values.
2023-06-09 09:34:34 -04:00
Guldoman a5e3d9757e
Revert "core syntax: strip the path from filename on syntax.get (#1168)" (#1322)
* Revert "core syntax: strip the path from filename on syntax.get (#1168)"

This reverts commit af6c4bc152.

The previous behavior was correct and allowed access to the full path for path-dependant syntaxes.

* Use `Doc.abs_filename` to obtain syntax when possible

This allows matching full paths in language syntaxes, but we lose the
possibility of matching the project root.
2023-06-09 09:31:59 -04:00
Guldoman 96251bdbfa
When logging don't use `core.status_view` if not yet initialized 2023-06-09 03:50:34 +02:00
Guldoman bc2f22e9e7
Mark `linewrapping` `open_files` table as weak
We weren't correctly garbage-collecting `Doc`s, so we had `Highlighter`s 
stay alive over their due time.
2023-05-24 04:23:27 +02:00
Guldoman d8581c9b3f
Add mouse grab (#1501)
* Add mouse grab

We now also send mouse movement events only to the interested view.

* Add deprecation messages handler

* Make various `View`s respect `on_mouse_left`

* `StatusView`
* `TitleView`
* `TreeView`
* `ToolbarView`

* Fix scrollbar in `TreeView` not updating

We were in some cases sending outdated mouse positions to the scrollbar, 
which made it think that the mouse was hovering it.

This also updates the hovered item more responsively during scroll.
2023-05-20 13:54:58 -04:00