Commit Graph

7423 Commits

Author SHA1 Message Date
Guilherme Soares
c4eb0b64bd
fix(treesitter): find buffer in multiple windows #28922
Problem:
1. When interacting with multiple :InspectTree and the source buffer
   windows there is a high chance of errors due to the window ids not
   being updated and validated.
2. Not all InspectTree windows were closed when the source buffer was
   closed.

Solution:
1. Update InspectTree window id on `CursorMoved` event and validate
   source buffer window id before trying to navigate to it.
2. Close all InspectTree windows
2024-05-27 04:20:03 -07:00
zeertzjq
9a0239fdc8
fix(drawline): don't draw beyond end of window (#29035) 2024-05-27 14:37:22 +08:00
zeertzjq
22fe04452e
vim-patch:9.1.0446: getregionpos() inconsistent for partly-selected multibyte char (#29032)
Problem:  getregionpos() behaves inconsistently for a partly-selected
          multibyte char.
Solution: Always use column of the first byte for a partly-selected
          multibyte char (zeertzjq).

closes: vim/vim#14851

ef73374dc3
2024-05-27 05:50:49 +08:00
luukvbaal
bc63ffcf39
fix(tui): reset clear_region attributes during startup #28713
Problem:  Fix added in #28676 worked accidentally(used variables were
          themselves uninitialized at this point during startup) and
          does not always work.
Solution: Reset attributes when clearing regions during startup.
2024-05-26 10:54:08 -07:00
Riley Bruins
eb37241d38
fix(tohtml): properly handle multiple hl groups #29012
Problem: :TOhtml doesn't properly handle virtual text when it has
multiple highlight groups. It also improperly calculates position offset
for multi-byte virt_text characters.

Solution: Apply the `vim.api.nvim_strwidth` broadly to properly
calculate character offset, and handle the cases where the `hl` argument
can be a table of multiple hl groups.
2024-05-26 10:27:12 -07:00
bfredl
b90d7c36cf refactor(tests): more global highlight definitions 2024-05-26 10:24:27 +02:00
bfredl
05a65432b6
Merge pull request #29006 from bfredl/apitest
refactor(tests): use more global highlight definitions
2024-05-26 09:40:05 +02:00
bfredl
fb43741f80 refactor(tests): use more global highlight definitions 2024-05-26 09:22:20 +02:00
zeertzjq
3d39ea3ea9
vim-patch:9.1.0442: hare runtime files outdated (#29011)
Problem:  hare runtime files outdated
Solution: runtime(hare): update hare.vim to match upstream
          (Amelia Clarke)

closes: vim/vim#14836

35dfe58a54

Co-authored-by: Amelia Clarke <selene@perilune.dev>
2024-05-26 07:11:50 +08:00
bfredl
a4b5549655 refactor(tests): update screen:snapshot_util() to use new-style highlights
This makes screen:snapshot_util() generate code with the new
screen:add_extra_attr_ids { ... } pattern. For convenience,
the old-style configuration is still detected and supported (until
all tests have been refactored, which is my goal for the 0.11 cycle)

Remove the last traces of the "ignore" attr anti-pattern. This code
is no longer functional, it is just "ignore" argument being passed around
like a hot potato at this point.
2024-05-25 19:01:27 +02:00
dundargoc
52389e7243 test(unit): skip flaky 'typval.c dict extend() works' test 2024-05-25 15:15:36 +02:00
zeertzjq
bdb81afab3
refactor(lua): rewrite vim.highlight.range() (#28986)
- Use getregionpos().
- Use a single extmark for non-blockwise selection.
2024-05-25 20:37:33 +08:00
bfredl
75f6ee5b26
Merge pull request #28617 from glepnir/border_hl
fix(float): missing default highlight for title
2024-05-25 11:13:58 +02:00
zeertzjq
4757d497f3
vim-patch:9.1.0444: Not enough tests for getregion() with multibyte chars (#29000)
Problem:  Not enough tests for getregion() with multibyte chars.
Solution: Add a few more tests (zeertzjq).

closes: vim/vim#14844

dff55a3358
2024-05-25 16:53:10 +08:00
glepnir
8b2b1fba2a fix(float): missing default highlight for title
Problem: there is missing default title highlight when highlight not defined in title text chunk.

Solution: when attr is not set use default title highlight group.
2024-05-25 15:34:29 +08:00
zeertzjq
06347a64ca
vim-patch:9.1.0443: Can't use blockwise selection with width for getregion() (#28985)
Problem:  Can't use a blockwise selection with a width for getregion().
Solution: Add support for blockwise selection with width like the return
          value of getregtype() or the "regtype" value of TextYankPost
          (zeertzjq).

closes: vim/vim#14842

afc2295c22
2024-05-25 05:19:46 +08:00
Gregory Anders
206f8f24a2
fix(fs): make vim.fs.root work for relative paths and unnamed buffers (#28964)
If a buffer does not have a backing file then fall back to the current
working directory.
2024-05-24 10:48:32 -05:00
zeertzjq
8db9a0e5a2
vim-patch:8.2.3158: strange error message when using islocked() with a number (#28962)
Problem:    Strange error message when using islocked() with a number.
            (Yegappan Lakshmanan)
Solution:   Check that the name is empty.

1840a7b4e3

Use ll_name_len instead.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-05-24 18:29:17 +08:00
Famiu Haque
a616272f56
feat(complete): specify reason for CompleteDone
Problem: `CompleteDone` currently does not specify the reason for why completion was done, which is problematic for completion plugins as they cannot know whether the event was triggered due to the completion being canceled, accepted, or for some other reason.

Solution: Add a `reason` key to `v:event`, which is set by `CompleteDone` to indicate why completion ended.
2024-05-24 11:57:46 +02:00
dundargoc
d123202ae6 fix: change deprecation presentation
Deprecation with vim.deprecate is currently too noisy. Show the
following warning instead:

[function] is deprecated. Run ":checkhealth vim.deprecated" for more information.

The important part is that the full message needs to be short enough to
fit in one line in order to not trigger the "Press ENTER or type command
to continue" prompt.

The full information and stack trace for the deprecated functions will
be shown in the new healthcheck `vim.deprecated`.
2024-05-24 11:08:00 +02:00
zeertzjq
4f431bb632
vim-patch:9.1.0439: Cannot filter the history (#28958)
Problem:  Cannot filter the history
Solution: Implement :filter :history

closes: vim/vim#14835

42a5b5a6d0

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-05-24 15:45:07 +08:00
zeertzjq
cd05fbef17
vim-patch:9.1.0441: getregionpos() can't properly indicate positions beyond eol (#28957)
Problem:  getregionpos() can't properly indicate positions beyond eol.
Solution: Add an "eol" flag that enables handling positions beyond end
          of line like getpos() does (zeertzjq).

Also fix the problem that a position still has the coladd beyond the end
of the line when its column has been clamped.  In the last test case
with TABs at the end of the line the old behavior is obviously wrong.

I decided to gate this behind a flag because returning positions that
don't correspond to actual characters in the line may lead to mistakes
for callers that want to calculate the length of the selected text, so
the behavior is only enabled if the caller wants it.

closes: vim/vim#14838

2b09de9104
2024-05-24 15:44:52 +08:00
zeertzjq
c836383d21
vim-patch:9.1.0438: Wrong Ex command executed when :g uses '?' as delimiter (#28956)
Problem:  Wrong Ex command executed when :g uses '?' as delimiter and
          pattern contains escaped '?'.
Solution: Don't use "*newp" when it's not allocated (zeertzjq).

closes: vim/vim#14837

3074137542
2024-05-24 15:04:33 +08:00
zeertzjq
e7859d2ad5
vim-patch:9.1.0436: Crash when using '?' as separator for :s (#28955)
Problem:  Crash when using '?' as separator for :s and pattern contains
          escaped '?'s (after 9.1.0409).
Solution: Always compute startplen. (zeertzjq).

related: neovim/neovim#28935
closes: 14832

789679cfc4
2024-05-24 05:57:00 +08:00
Christian Clason
0d3d198109 vim-patch:9.1.0435: filetype: cygport files are not recognized
Problem:  filetype: cygport files are not recognized
Solution: Recognize '*.cygport' files as sh filetype
          (Ken Takata)

https://cygwin.github.io/cygport/cygport_in.html

closes: vim/vim#14833

cd79f8fbd3

Co-authored-by: K.Takata <kentkt@csc.jp>
2024-05-23 23:47:13 +02:00
Evgeni Chasnovski
0a2218f965
fix(comment): fall back to using trimmed comment markers (#28938)
Problem: Currently comment detection, addition, and removal are done
  by matching 'commentstring' exactly. This has the downside when users
  want to add comment markers with space (like with `-- %s`
  commentstring) but also be able to uncomment lines that do not contain
  space (like `--aaa`).

Solution: Use the following approach:
  - Line is commented if it matches 'commentstring' with trimmed parts.
  - Adding comment is 100% relying on 'commentstring' parts (as is now).
  - Removing comment is first trying exact 'commentstring' parts with
    fallback on trying its trimmed parts.
2024-05-23 15:30:53 -05:00
Ilia Choly
af200c10cf
fix(lsp): check if buffer was detached in on_init callback (#28914)
Co-authored-by: Jongwook Choi <wookayin@gmail.com>
2024-05-23 15:17:53 +02:00
Andre Toerien
5ac8db10f0
fix(lsp): trigger LspDetach on buffer delete (#28795)
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
2024-05-23 12:03:47 +02:00
zeertzjq
bdf15dbe69
vim-patch:9.1.0433: Wrong yanking with exclusive selection and ve=all (#28933)
Problem:  Wrong yanking with exclusive selection and virtualedit=all,
          and integer overflow when using getregion() on it.
Solution: Set coladd when decreasing column and 'virtualedit' is active.
          Add more tests for getregion() with 'virtualedit' (zeertzjq).

closes: vim/vim#14830

701ad50a9e
2024-05-23 14:23:09 +08:00
zeertzjq
cd48b72b60
fix(shada): restore search pattern length properly (#28929) 2024-05-23 09:10:16 +08:00
zeertzjq
5cbd6d9b9f
vim-patch:9.1.0430: getregionpos() doesn't handle one char selection (#28924)
Problem:  getregionpos() doesn't handle one char selection.
Solution: Handle startspaces differently when is_oneChar is set.
          Also add a test for an exclusive charwise selection with
          multibyte chars (zeertzjq)

closes: vim/vim#14825

52a6f34887
2024-05-23 06:08:24 +08:00
dundargoc
01b4da65c2 fix: merge all provider healthchecks into a single health.lua
This will help manage the overly granular checkhealth completion to go
from

```
vim.health
vim.lsp
vim.provider.clipboard
vim.provider.node
vim.provider.perl
vim.provider.python
vim.provider.ruby
vim.treesitter
```

to

```
vim.health
vim.lsp
vim.provider
vim.treesitter
```
2024-05-22 21:34:49 +02:00
zeertzjq
10601ac5fa
vim-patch:62ccaa6: runtime(termdebug): check for gdb file/dir before using as buffer name (#28908)
Add test so that this doesn't regress.

fixes: vim/vim#12718
closes: vim/vim#14792

62ccaa60d5

Co-authored-by: Ubaldo Tiberi <ubaldo.tiberi@volvo.com>
2024-05-22 08:41:07 +08:00
zeertzjq
81a1d7258c
vim-patch:9.1.0427: tests: some issues with termdebug mapping test (#28907)
Problem:  tests: some issues with termdebug mapping test
Solution: Use assert_{true,false} if suitable, change
          order of expected and actual arguments in assert() calls.
          (Ken Takata)

closes: vim/vim#14818
related: 7fbbd7f

ffed1540f3

Co-authored-by: Ken Takata <kentkt@csc.jp>
2024-05-22 07:19:12 +08:00
zeertzjq
59fe8ffdea vim-patch:9.1.0428: Tag guessing leaves wrong search history with very short names
Problem:  Tag guessing leaves wrong search history with very short names
          (after 9.1.0426).
Solution: Use the correct variable for pattern length (zeertzjq).

closes: vim/vim#14817

42cd192daa

Cherry-pick Test_tagbsearch() changes from patch 9.0.0767.
2024-05-22 06:37:26 +08:00
zeertzjq
b86381f425 vim-patch:9.1.0426: too many strlen() calls in search.c
Problem:  too many strlen() calls in search.c
Solution: refactor code and remove more strlen() calls,
          use explicit variable to remember strlen
          (John Marriott)

closes: vim/vim#14796

8c85a2a49a

Co-authored-by: John Marriott <basilisk@internode.on.net>
2024-05-22 06:37:26 +08:00
Riley Bruins
a108852b00
fix(lsp): semantic token functions allow "0" bufnr #28849
aligns with ":help dev-patterns"
2024-05-21 09:25:54 -07:00
Tobias Schmitz
ad191be65e
feat(signs)!: place higher-priority signs from the left #27781
Problem:
Higher-priority signs may be hidden by lower-priority signs.

Solution:
Place higher-priority signs from the left.

Example:

    nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='H', priority=1})
    nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='W', priority=2})
    nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='E', priority=3})

Before:

            |     |
          H | W E |
          ^ |     |
Not visible

After:

  |     |
  | E W | H
  |     | ^
          Not visible

Fixes #16632
2024-05-21 09:21:42 -07:00
zeertzjq
91892f56b6
vim-patch:9.1.0399: block_editing errors out when using del (#28867)
Problem:  block_editing errors out when using del
          (@Jamarley)
Solution: Change ins_len from size_t to int and
          properly check that it doesn't become negative

There is a check in os.c that verifies that `ins_len` does not become
negative:
```
if (pre_textlen >= 0 && (ins_len = len - pre_textlen - offset) > 0)
```
However this only works, if ins_len can actually become negative and
unfortunately, ins_len has been declared as `size_t` so instead of
becoming negative it will wrap around and be very large.

So let's define it as integer, after which the condition above
properly catches this condition.

fixes: vim/vim#14734
closes: vim/vim#14735

d5c8c0920e

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-05-20 21:45:02 +08:00
zeertzjq
e0259b9466 vim-patch:9.1.0423: getregionpos() wrong with blockwise mode and multibyte
Problem:  getregionpos() wrong with blockwise mode and multibyte.
Solution: Use textcol and textlen instead of start_vcol and end_vcol.
          Handle coladd properly (zeertzjq).

Also remove unnecessary buflist_findnr() in add_regionpos_range(), as
getregionpos() has already switched buffer.

closes: vim/vim#14805

c95e64f41f
2024-05-20 20:59:54 +08:00
zeertzjq
d89144626e vim-patch:9.1.0394: Cannot get a list of positions describing a region
Problem:  Cannot get a list of positions describing a region
          (Justin M. Keyes, after v9.1.0120)
Solution: Add the getregionpos() function
          (Shougo Matsushita)

fixes: vim/vim#14609
closes: vim/vim#14617

b4757e627e

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2024-05-20 20:50:08 +08:00
Christian Clason
5c2616846a vim-patch:9.1.0425: filetype: purescript files are not recognized
Problem:  filetype: purescript files are not recognized
Solution: recognize '*.purs' files as purescript filetype,
          include basic purescript filetype plugin
          (Riley Bruins)

Reference: https://github.com/purescript/documentation/blob/master/language/Syntax.md#comments

closes: vim/vim#14813

155583a5c3

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2024-05-20 14:43:12 +02:00
Christian Clason
70c0b03e61 vim-patch:9.1.0424: filetype: slint files are not recognized
Problem:  filetype: slint files are not recognized
Solution: Detect '*.slint' files as slint filetype,
          include basic sling filetype plugin
          (Riley Bruins)

closes: vim/vim#14808

aa3104b07a

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2024-05-20 14:43:12 +02:00
Christian Clason
b16b287b8f vim-patch:9.1.0421: filetype: hyprlang files are not recognized
Problem:  filetype: hyprlang files are not recognized
Solution: recognize 'hypr{land,paper,idle,lock}.conf' files
          as 'hyprlang' filetype, add hyprlang ftplugin
          (Riley Bruins)

closes: vim/vim#14803

5f1b115afd

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2024-05-20 00:13:40 +02:00
dundargoc
0f4f7d32ce refactor!: remove nvim and provider module for checkhealth
The namespacing for healthchecks for neovim modules is inconsistent and
confusing. The completion for `:checkhealth` with `--clean` gives

```
nvim
provider.clipboard
provider.node
provider.perl
provider.python
provider.ruby
vim.lsp
vim.treesitter
```

There are now three top-level module names for nvim: `nvim`, `provider`
and `vim` with no signs of stopping. The `nvim` name is especially
confusing as it does not contain all neovim checkhealths, which makes it
almost a decoy healthcheck.

The confusion only worsens if you add plugins to the mix:

```
lazy
mason
nvim
nvim-treesitter
provider.clipboard
provider.node
provider.perl
provider.python
provider.ruby
telescope
vim.lsp
vim.treesitter
```

Another problem with the current approach is that it's not easy to run
nvim-only healthchecks since they don't share the same namespace. The
current approach would be to run `:che nvim vim.* provider.*` and would
also require the user to know these are the neovim modules.

Instead, use this alternative structure:

```
vim.health
vim.lsp
vim.provider.clipboard
vim.provider.node
vim.provider.perl
vim.provider.python
vim.provider.ruby
vim.treesitter
```

and

```
lazy
mason
nvim-treesitter
telescope
vim.health
vim.lsp
vim.provider.clipboard
vim.provider.node
vim.provider.perl
vim.provider.python
vim.provider.ruby
vim.treesitter
```

Now, the entries are properly sorted and running nvim-only healthchecks
requires running only `:che vim.*`.
2024-05-19 11:46:34 +02:00
zeertzjq
62eb7e79a5
vim-patch:9.1.0418: Cannot move to previous/next rare word (#28822)
Problem:  Cannot move to previous/next rare word
          (Colin Kennedy)
Solution: Add the ]r and [r motions (Christ van Willegen)

fixes: vim/vim#14773
closes: vim/vim#14780

8e4c4c7d87

Co-authored-by: Christ van Willegen - van Noort <github.com@vanwillegen-vannoort.nl>
2024-05-18 07:09:05 +08:00
zeertzjq
5947f249f8
fix(move): half-page scrolling with resized grid at eob (#28821) 2024-05-18 07:00:29 +08:00
zeertzjq
5f9e7edae6
Merge pull request #28790 from luukvbaal/vim-9.1.0414
vim-patch:9.1.{0414,0416}
2024-05-18 06:13:46 +08:00
Gregory Anders
4c0d18c197
fix(vim.iter): enable optimizations for arrays (lists with holes) (#28781)
The optimizations that vim.iter uses for array-like tables don't require
that the source table has no holes. The only thing that needs to change
is the determination if a table is "list-like": rather than requiring
consecutive, integer keys, we can simply test for (positive) integer
keys only, and remove any holes in the original array when we make a
copy for the iterator.
2024-05-17 14:17:25 -05:00
Luuk van Baal
f178b8ba49 vim-patch:9.1.0414: Unable to leave long line with 'smoothscroll' and 'scrolloff'
Problem:  Unable to leave long line with 'smoothscroll' and 'scrolloff'.
          Corrupted screen near the end of a long line with 'scrolloff'.
          (Ernie Rael, after 9.1.0280)
Solution: Only correct cursor in case scroll_cursor_bot() was not itself
          called to make the cursor visible. Avoid adjusting for
          'scrolloff' beyond the text line height (Luuk van Baal)

b32055e504

vim-patch:9.1.0416: some screen dump tests can be improved

Problem:  some screen dump tests can be improved (after 9.1.0414)
Solution: Make sure screen state changes properly and is captured in the
          screen dumps (Luuk van Baal)

2e642734f4
2024-05-17 20:28:14 +02:00