Commit Graph

1063 Commits

Author SHA1 Message Date
Guldoman 2ed17dd03f 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-12-26 13:16:33 +00:00
Takase 3f3b4d52b4 docs(core.contextmenu): add documentation for contextmenu (#1567) 2023-12-26 13:16:33 +00:00
Guldoman 9bc44e2b45 Fix returned `percent` when clicking the `Scrollbar` `track` 2023-12-26 13:16:33 +00:00
Guldoman 50102fdc3a Fix `scrollbar` misinterpreting `percent` (#1587) 2023-12-26 13:16:33 +00:00
Takase dc14860166 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-12-26 13:16:33 +00:00
Guldoman 6d5c6051cd 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-07 14:51:14 +01:00
Guldoman 16bfa6d958 Use proper timeouts for coroutines that don't need to wait (#1467) 2023-08-07 14:51:14 +01:00
Delta-official 9c9f2dace0 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-07 14:51:14 +01:00
Adam 5145194f1f 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-07 14:51:14 +01:00
Takase 6ad67c18f0 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-08-07 14:51:14 +01:00
Takase ac3630c2ea 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-08-07 14:51:14 +01:00
Adam c470683005 Updated extension for mac. (#1563) 2023-08-07 14:51:14 +01:00
Guldoman 0ebf3c0393 Return state when tokenizing plaintext syntaxes 2023-08-07 14:51:14 +01:00
Guldoman ca3acd4ee9 Skip checking `files` if no filename was provided to `syntax.get` 2023-08-07 14:51:14 +01:00
Luke aka SwissalpS 0e5f35ff9f 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-08-07 14:51:14 +01:00
Luke aka SwissalpS 39319e2ce9 comment typo in object.lua (#1541) 2023-08-07 14:51:14 +01:00
Jan e6c7001b5a Add top tab margins (#1479)
adapted from #810 to allow styles to decide upon the top margin of the tab list
2023-08-07 14:50:59 +01:00
Guldoman 94b4825754 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-08-07 14:50:59 +01:00
Guldoman 12a552931e 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-08-07 14:50:59 +01:00
Guldoman ff38e449d1 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-08-07 14:50:59 +01:00
Guldoman f80a4563be When logging don't use `core.status_view` if not yet initialized 2023-08-07 14:50:59 +01:00
Guldoman 528e5641fb 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-08-07 14:50:59 +01:00
takase1121 c255e53d37 feat(bootstrap): return error string from C searcher 2023-08-07 14:50:59 +01:00
Adam aa2ac0a4ce Added in double-clicking on emptyview and tab bar. (#1478)
* Added in double-clicking on emptyview and tab bar.

* Fixed issue with split tabs.

* Early exit if no overlapping node.

* Changed category of command to tabbar.

* Additional cleanup.

* Changed for whether we should show tabs.

* Fixed erroneous hover.
2023-08-07 14:50:59 +01:00
jgmdev ff4364b0ff StatusView compat fix with older Lua runtimes 2023-08-07 14:50:59 +01:00
Guldoman 532d3a6572 Merge carets after `doc:move-to-{previous,next}-char` (#1462) 2023-08-07 14:50:58 +01:00
sammyette 2978037f51 feat: add statusview item to show selections (#1445) 2023-08-07 14:50:58 +01:00
vqn 7aa1217878 #1393 followup (#1463)
* Fix incorrect check in doc:raw_remove

Restore caret position on command doc:cut

* merge cursors and fix new line in clipboard

* add new line to the last copied line
2023-08-07 14:50:58 +01:00
Jan 662fde364b Add View dragging (#1402) 2023-08-07 14:50:58 +01:00
Adam 7ca0ec18ca Added in support for foreground and background events. (#1395) 2023-08-07 14:50:58 +01:00
vqn 46ea86e28c fix cursors positions when deleting multiple selections (#1393)
* correctly handle overlapping selections merge cursors in Doc:raw_remove
2023-08-07 14:50:58 +01:00
Adam ee80b451c6 Added in explicit touchscreen keyboard support. (#1389) 2023-08-07 14:50:58 +01:00
Guldoman 1c8c569fae Allow `tokenizer` to pause and resume in the middle of a line (#1444) 2023-08-07 14:50:58 +01:00
Adam 1becf35508 Disable `trimwhitespace` and `drawwhitespace` via their configs (#1446)
Instead of completely disabling them, we now use their internal toggle.

Also moved `drawwhitespace` commands inside the plugin.

---

* Fixed bug where commands would show even when plugin was disbled. Also removed antiquated way of disabling.

* Fixed typos.

* Also moved trimwhitespace out of config, if it already has a default enabled value of false.

* Changed documentation.

* Clarified comments.
2023-08-07 14:50:58 +01:00
Guldoman b005454652 Limit `core.threads` without a timeout to run 30 times per second 2023-08-07 14:50:58 +01:00
Adam Harrison 73ff025552 Made things clearer, as per jgm's suggestion. 2023-08-07 14:50:58 +01:00
Adam 7f0651155d Made coroutines make more sense, and fixed a bug. (#1381)
* Made coroutines make more sense, and fixed a bug.

* Fixed typo.

* Additional checking for off-cycles.

* Fixed issue with calling step too much.

* If we have no redraw, set next step time for next frame.

* Added in `now` variables to reduce calls.
2023-08-07 14:50:58 +01:00
Guldoman 146dca9188 Don't calculate widths per-uft8-char when not needed (#1409) 2023-08-07 14:50:58 +01:00
Guldoman e1f92683bc Use correct view for scrolling to `find-replace:repeat-find` results (#1400) 2023-08-07 14:50:58 +01:00
Adam 83c27cf9f4 Added in ability to specify prefix via env variable. (#1388) 2023-08-07 14:50:58 +01:00
vqn 9b4a86f763 fix incorrect x_offset if opened docs have different tab sizes (#1383) 2023-08-07 14:50:58 +01:00
Guldoman 7e0ddf2817 Make tab scrolling more flexible (#1384)
* Add `Object:{is_class_of,is_extended_by}` to check inverse relationships

* Make tab scrolling more flexible

This adds tab scrolling commands and connects them to mouse scroll
events.
This way scrolling behavior can be customized more easily.

For example an alternative behavior could be:
```lua
keymap.add({
  ["wheelup"] = "root:switch-to-hovered-previous-tab",
  ["wheeldown"] = "root:switch-to-hovered-next-tab"
})
```
2023-08-07 14:50:58 +01:00
jgmdev 51ab72f715 Correct the inverted tabs scrolling 2023-08-07 14:50:58 +01:00
Eric Gaudet 911eb325cc Make mouse scrollwheel hovering tabs scroll the tab bar (#1314) 2023-08-07 14:50:58 +01:00
Guldoman d9925b7d44 Allow groups to be used in end delimiter patterns in tokenizer (#1317)
* Allow empty groups as first match in tokenizer
* Avoid pushing tokens with empty strings
* Allow groups to be used in end delimiter in tokenizer
* Use the first entry of the type table for the middle part of a subsyntax
This applies to delimited matches with a table for `type` and without a 
`syntax` field.
* Match only once if using `at_start` in tokenizer `find_text`
* Check if match is escaped in the "close" case too
Also allow continuing matching if the match was escaped.
2023-08-07 14:50:58 +01:00
Guldoman be5d23557d Improve `DocView:get_visible_line_range` precision (#1382) 2023-08-07 14:50:58 +01:00
Jefferson González 84039331a5 NagView: properly rescale on scale change (#1379)
* drop font option since style.font is always used
2023-08-07 14:50:58 +01:00
Jefferson González 1c2571bad7 Restore in-selection replace as discussed in #1331 (#1368) 2023-08-07 14:50:58 +01:00
Jefferson González d68583b688 Improved plugins config table handling (#1356)
* Warns user if trying to disable a plugin that is already
  enabled when doing `config.plugins.plugin_name = false` and also
  prevents replacing the current plugin config table with the false
  value to mitigate runtime issues.
* Uses a merge strategy by default when assigning a table to a plugin
  config to prevent a user from removing a plugin default config values
  as experienced and explained on this issue lite-xl-plugins#158
* This change is basically backwards compatible, but will require a
  change on the settings ui plugin on how it checks for already
  enabled plugins, since rawget will no longer be a working hack
  or workaround for this.
* As suggested by Adam dropped loaded key and switched to package.loaded
2023-08-07 14:50:58 +01:00
Guldoman 57cd4e2949 Make mod-version follow semver (#1036)
* Make mod-version follow semver
  Now plugins can optionally specify the minor and patch version they 
support.
  If no minor or patch version is specified, it's considered 0.
  Plugins are only loaded if they have the same major version and a 
  smaller or equal minor+patch version.
* Add modversion to logging and plugin mismatch nagview

---------

Co-authored-by: Jefferson González <jgmdev@gmail.com>
2023-08-07 14:50:58 +01:00