Commit Graph

27618 Commits

Author SHA1 Message Date
dundargoc
4f526b9fd8 build: use neovim/libtermkey instead of neovim/deps for libtermkey
Using a mirror makes it easier to test patches as well as reducing
maintenance when a new version is released.
2023-10-28 22:32:52 +02:00
bfredl
c5f2472661
Merge pull request #25812 from famiu/test/api/option_value/modified
test: add test coverage for #25741
2023-10-28 21:47:40 +02:00
Famiu Haque
43a7945f1b test: add test coverage for #25741 2023-10-28 22:51:07 +06:00
dundargoc
7a5effb0f9 build: bump required minimum libvterm version to 0.3.3
Also add detection for libvterm patch version.
2023-10-28 10:46:58 +02:00
zeertzjq
ac353e87ae
vim-patch:9.0.2075: TextChangedI may not always trigger (#25808)
Problem:  TextChangedI may not always trigger
Solution: trigger it in more cases: for insert/
          append/change operations, and when
          opening a new line,

fixes: vim/vim#13367
closes: vim/vim#13375

4bca4897a1

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-28 10:42:18 +08:00
zeertzjq
f97248db75
vim-patch:9.0.2070: [security] disallow setting env in restricted mode (#25807)
Problem:  [security] disallow setting env in restricted mode
Solution: Setting environment variables in restricted mode could
          potentially be used to execute shell commands. Disallow this.

restricted mode: disable allow setting of environment variables

Setting environment variables in restricted mode, may have some unwanted
consequences. So, for example by setting $GCONV_PATH in restricted mode
and then calling the iconv() function, one may be able to execute some
unwanted payload, because the `iconv_open()` function internally uses
the `$GCONV_PATH` variable to find its conversion data.

So let's disable setting environment variables, even so this is no
complete protection, since we are not clearing the existing environment.
I tried a few ways but wasn't successful :(

One could also argue to disable the iconv() function completely in
restricted mode, but who knows what other API functions can be
influenced by setting some other unrelated environment variables.
So let's leave it as it is currently.

closes: vim/vim#13394
See: https://huntr.com/bounties/b0a2eda1-459c-4e36-98e6-0cc7d7faccfe/

6b89dd6a72

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-28 10:06:43 +08:00
zeertzjq
d2e7cc68e9
Merge pull request #25806 from zeertzjq/vim-9.0.2074
vim-patch:9.0.{2074,2077}: Completion menu may be wrong
2023-10-28 06:44:08 +08:00
Christian Clason
9455f6b17c vim-patch:650dcfc8d12e
runtime(netrw): don't echo empty lines (vim/vim#13431)

650dcfc8d1

Co-authored-by: nwounkn <nwounkn@gmail.com>
2023-10-28 00:24:40 +02:00
zeertzjq
063a78fda2 vim-patch:9.0.2077: CI fails because of trailing whitespace in test
Problem:  CI fails because of trailing whitespace in test
Solution: Remove it

87ca5e86fa

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-28 06:17:08 +08:00
zeertzjq
0b23207c73 vim-patch:9.0.2074: Completion menu may be wrong
Problem:  Completion menu may be wrong
Solution: Check for the original direction of the completion menu,
          add more tests, make it work with 'noselect'

completion: move in right direction when  filling completion_info()

When moving through the insert completion menu and switching directions,
we need to make sure we start at the correct position in the list and
move correctly forward/backwards through it, so that we do not skip
entries and the selected item points to the correct entry in the list
of completion entries generated by the completion_info() function.

The general case is this:

1) CTRL-X CTRL-N, we will traverse the list starting from
   compl_first_match and then go forwards (using the cp->next pointer)
   through the list (skipping the very first entry, which has the
   CP_ORIGINAL_TEXT flag set (since that is the empty/non-selected entry

2) CTRL-X CTRL-P, we will traverse the list starting from
   compl_first_match (which now points to the last entry). The previous
   entry will have the CP_ORIGINAL_TEXT flag set, so we need to start
   traversing the list from the second prev pointer.

There are in fact 2 special cases after starting the completion menu
with CTRL-X:

3)  CTRL-N and then going backwards by pressing CTRL-P again.
    compl_first_match will point to the same entry as in step 1 above,
    but since compl_dir_foward() has been switched by pressing CTRL-P
    to backwards we need to pretend to be in still in case 1 and still
    traverse the list in forward direction using the cp_next pointer

4)  CTRL-P and then going forwards by pressing CTRL-N again.
    compl_first_match will point to the same entry as in step 2 above,
    but since compl_dir_foward() has been switched by pressing CTRL-N
    to forwards we need to pretend to be in still in case 2 and still
    traverse the list in backward direction using the cp_prev pointer

For the 'noselect' case however, this is slightly different again. When
going backwards, we only need to go one cp_prev pointer back. And
resting of the direction works again slightly different. So we need to
take the noselect option into account when deciding in which direction
to iterate through the list of matches.

related: vim/vim#13402
related: vim/vim#12971
closes: vim/vim#13408

daef8c7437

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-28 06:16:55 +08:00
Jongwook Choi
add1b10b79
fix(diagnostic): virtual_text prefix function should have index and total (#25801)
The prefix option of the diagnostic virtual text can be a function,
but previously it was only a function of diagnostic.

This function should also have additional parameters index and total,
more consistently and similarily as in the prefix function for
`vim.diagnostic.open_float()`.

These additional parameters will be useful when there are too many
number of diagnostics in a single line.
2023-10-27 08:17:46 -05:00
Christian Clason
4fcdfa5ad0 vim-patch:7b7cda67a124
runtime(debian): update debian related runtime files (vim/vim#13423)

* Update Debian runtime files

Add mantic as a supported Ubuntu release and move buster/kinetic to
unsupported.

Add syntax highlighting for deb822sources filetype.

Add debsources ftplugin to set relevant comment options.

Move common version information to shared/debversions.vim

Closes vim/vim#11934

* Add myself as codeowner for Debian-related runtime files

---------

7b7cda67a1

Co-authored-by: James McCoy <jamessan@jamessan.com>
Co-authored-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Co-authored-by: James Addison <jay@jp-hosting.net>
Co-authored-by: Viktor Szépe <viktor@szepe.net>
Co-authored-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Co-authored-by: James Addison <jay@jp-hosting.net>
Co-authored-by: Viktor Szépe <viktor@szepe.net>
2023-10-27 10:06:52 +02:00
Christian Clason
5753e5e7eb vim-patch:9.0.2071: objdump files not recognized
Problem:  objdump files not recognized
Solution: detect *.objdump files, add a filetype plugin

Added the objdump file/text format

closes: vim/vim#13425

10407df7a9

Co-authored-by: Colin Kennedy <colinvfx@gmail.com>
2023-10-27 10:03:09 +02:00
zeertzjq
9dc440400c
vim-patch:9.0.2068: [security] overflow in :history (#25794)
Problem:  [security] overflow in :history
Solution: Check that value fits into int

The get_list_range() function, used to parse numbers for the :history
and :clist command internally uses long variables to store the numbers.
However function arguments are integer pointers, which can then
overflow.

Check that the return value from the vim_str2nr() function is not larger
than INT_MAX and if yes, bail out with an error. I guess nobody uses a
cmdline/clist history that needs so many entries... (famous last words).

It is only a moderate vulnerability, so impact should be low.

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-q22m-h7m2-9mgm

9198c1f2b1

N/A patch:
vim-patch:9.0.2073: typo in quickfix.c comments

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-27 06:37:52 +08:00
Lajos Koszti
ba6761eafe
fix(lsp): fix omnicomplete in middle of the line (#25787)
Fixes a regression from 5e5f5174e3

Until that commit we had a logic like this:
`local prefix = startbyte and line:sub(startbyte + 1) or line_to_cursor:sub(word_boundary)`

The commit changed the logic and no longer cut off the line at the cursor,  resulting in a prefix that included trailing characters
2023-10-26 22:40:36 +02:00
Maria José Solano
15983cf2c6
fix(lsp): cancel session when leaving snippet region (#25762) 2023-10-26 07:29:05 +02:00
nwounkn
9de157bce4
fix(float): win_get_bordertext_col returning negative column number (#25752)
Problem:
  `win_get_bordertext_col` returns column < 1 for right or center
  aligned text, if its length is more than window width.

Solution:
  Return max(resulting_column, 1)
2023-10-26 11:44:28 +08:00
zeertzjq
f2fc44550f
vim-patch:9.0.2064: cannot use buffer-number for errorformat (#25782)
Problem:  cannot use buffer-number for errorformat
Solution: add support for parsing a buffer number using '%b' in
          'errorformat'

closes: vim/vim#13419

b731800522

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-26 07:42:29 +08:00
zeertzjq
bfe8a39512
vim-patch:partial:5985879e3c36 (#25780)
runtime(doc): Fix typos in several documents (vim/vim#13420)

* Fix typos in several documents
* Update runtime/doc/terminal.txt

5985879e3c

Skip runtime/doc/indent.txt: not ported yet

Co-authored-by: h_east <h.east.727@gmail.com>
Co-authored-by: K.Takata <kentkt@csc.jp>
2023-10-26 06:41:54 +08:00
zeertzjq
3347519dd7
vim-patch:9.0.2065: EXPAND flag set for filetype option (#25779)
Problem:  EXPAND flag set for filetype option
Solution: Remove P_EXPAND flag from the 'filetype' option

Remove P_EXPAND flag from the 'filetype' option

Problem:  P_EXPAND flag is erroneously set for 'filetype' option
Solution: Remove the P_EXPAND flag

This flag is used by string options that accept file path values.  See
:help set_env.

This appears to have been included in d5e8c92 and resulted from an
incorrect implementation of 'filetype' completion.

See vim/vim#12900 for a small discussion.

related: vim/vim#12900
closes: vim/vim#13416

3932072ab4

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2023-10-26 06:34:56 +08:00
zeertzjq
684e93054b
fix(terminal): assign channel to terminal earlier (#25771) 2023-10-25 09:59:02 +08:00
dundargoc
1094d0c0db build: add CMAKE_C_FLAGS to --version output
Closes https://github.com/neovim/neovim/issues/25754.
2023-10-24 11:09:15 +02:00
Christian Clason
0b1ec3b162 vim-patch:9.0.2063: pacman hooks are detected as conf filetype
Problem:  pacman hooks are detected as conf filetype
Solution: make it consistent to pacman.conf and detect those
          hooks as confini

Because confini has much better syntax highlighting than conf.

For reference, I identified pacman.conf and pacman hooks as dosini in
https://github.com/vim/vim/pull/6335, then
https://github.com/vim/vim/pull/10213 changed them to conf, then
https://github.com/vim/vim/pull/10518 changed pacman.conf to confini but
forgot to change hooks.

closes: vim/vim#13399

7d254dbc2d

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2023-10-24 10:15:47 +02:00
Christian Clason
4f0adb6a78 vim-patch:9.0.2062: Janet files are not recognised
Problem:  Janet files are not recognised
Solution: Add filename and shebang detection (without
          adding an extra filetype plugin)

Those are used by the Janet language:
http://www.janet-lang.org

closes: vim/vim#13400

c038427d2a

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2023-10-24 10:15:47 +02:00
Christian Clason
94fee35446 vim-patch:9.0.2061: not able to detect xkb filetypes
Problem:  not able to detect xkb filetypes
Solution: Detect files below /u/s/X11/xkb as xkb files (without adding
          an extra filetype)

Those files are used from the X11 xkb extension

closes: vim/vim#13401

ae9021a840

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2023-10-24 10:15:47 +02:00
Christian Clason
5f0224e848 vim-patch:9.0.2060: *.{gn,gni} files are not recognized
Problem:  *.{gn,gni} files are not recognized
Solution: Detect some as gn filetype (without adding an extra filetype)

Those come from: https://gn.googlesource.com/gn/

closes: vim/vim#13405

84394f2be4

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2023-10-24 10:15:47 +02:00
zeertzjq
d432bba4e4
fix(marks): handle switching buffer properly (#25763) 2023-10-24 16:10:36 +08:00
dundargoc
25cfe3fd43 build: enable formatting during rebase
Closes https://github.com/neovim/neovim/issues/25654
2023-10-23 21:48:06 +02:00
dundargoc
5f03a1eaab build(lint): remove unnecessary clint.py rules
Uncrustify is the source of truth where possible.
Remove any redundant checks from clint.py.
2023-10-23 20:06:21 +02:00
Christian Clason
e606604322 vim-patch:fea96c00e55a
runtime(vim): Update ftplugin - comment motions (vim/vim#13412)

Fix the pattern used by comment-motion mappings to match the start of a
block comment.

Block-comment start lines were being ignored if the previous line
contained a double-quote character anywhere in the line.  Line comments
should only be ignored if the previous line is a full-line comment and,
therefore, part of the current block comment.

fea96c00e5

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-10-23 19:48:50 +02:00
Maria José Solano
94127cb5df fix(lsp): do not add extra indentation 2023-10-23 17:21:41 +02:00
Maria José Solano
370232dbef fix(lsp): track snippet deletion 2023-10-23 17:21:41 +02:00
Mathias Fussenegger
5e5f5174e3 fix(lsp): fix off-by-one error for omnifunc word boundary
Fixes https://github.com/neovim/neovim/issues/25177

I initially wanted to split this into a refactor commit to make it more
testable, but it appears that already accidentally fixed the issue by
normalizing lnum/col to 0-indexing
2023-10-23 08:26:38 +02:00
dundargoc
bc850ba2a0 ci: run tests in parallel
This will run the three test suites (unit, functional and old) in
parallel, meaning that neovim is built for each test and run separately.
This has a slight increase in total CI usage, but it allows rerunning
only the specific test suite that failed for flaky tests, which will
save some time.

Ideally we'd remove any drawbacks by building neovim once and reusing it
for each test suite, but that is not currently possible due to poor
upload/download speeds of the upload-artifact and download-artifact
actions. This has been addressed in
https://github.com/actions/toolkit/pull/1488, but will only be made
available in upload-artifact@v4 and download-artifact@v4.
2023-10-22 16:13:34 +02:00
dundargoc
3a3e025126 ci: install perl provider on mac
Perl provider installation was previously disabled on mac due to a
version conflict in 79bf507449. It is no
longer present, so we enable it.
2023-10-21 21:54:11 +02:00
bfredl
999879a512
Merge pull request #25741 from famiu/fix/options/modified
fix(options): `'modified'` showing incorrect value for scratch buffers
2023-10-21 21:46:51 +02:00
Famiu Haque
9d01385c6c fix(options): 'modified' showing incorrect value for scratch buffers
Problem: #25716 removed the logic for getting the correct value of the `'modified'` option when using `nvim_buf_get_option()`. So the function now returns an incorrect value of `'modified'` for scratch buffers.

Solution: Re-add the logic for getting the correct value of `'modified'`. Also make it so that the logic only exists in one place instead of being duplicated across multiple places in the code.
2023-10-22 01:17:27 +06:00
bfredl
40574b424f
Merge pull request #25624 from glepnir/fix_25598
feat(complete): support f flag for complete buffer name part
2023-10-21 15:52:47 +02:00
Christian Clason
752c6ce4ad build(deps): bump luajit to HEAD - e826d0c10 2023-10-21 14:14:12 +02:00
glepnir
ae4ca4edf8 feat(complete): support f flag for complete buffer part 2023-10-21 20:06:36 +08:00
Mathias Fussenegger
195301c609 refactor(lsp): deprecate completion util methods
Relates to https://github.com/neovim/neovim/issues/25272
2023-10-21 13:49:05 +02:00
Mathias Fussenegger
1e10310f4c refactor(lsp): move completion logic into _completion module
To reduce cross-chatter between modules and for https://github.com/neovim/neovim/issues/25272
Also preparing for https://github.com/neovim/neovim/issues/25714
2023-10-21 13:49:05 +02:00
zeertzjq
9971bea6f1
vim-patch:9.0.2059: outstanding exceptions may be skipped (#25736)
Problem:  outstanding exceptions may be skipped
Solution: When restoring exception state, process remaining outstanding
          exceptions

closes: vim/vim#13386

0ab500dede

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-21 18:46:52 +08:00
zeertzjq
c049ce56cd
vim-patch:9.0.2058: tests: avoid error when no swap files exist (#25735)
Problem:  tests: avoid error when no swap files exist
Solution: use unlet! so that no error message is reported
          in case the variable does not exists

When s:GetSwapFileList() does not find any swapfiles, it will return an
empty list []. This means, that the variable 'name' will not be
declared, cause the following unlet command to fail and causing a 1 sec
delay on running the tests.

So let's instead use the :unlet! command which simply skips reporting an
error when the variable given as parameter does not exists.

closes: vim/vim#13396

a36acb7ac4
2023-10-21 18:14:32 +08:00
zeertzjq
fc02908c97
vim-patch:d3e277f279ed (#25734)
matchparen: do not use hard-coded match id (vim/vim#13393)

* matchparen: do not use hard-coded match id

Instead of using the hard-coded match id 3, which may also be used by
other plugins, let the matchparen plugin use whatever ids are
automatically returned when calling matchaddpos().

For backwards-compatibility, keep the `:3match` call, which will still
use the hard-coded id 3 (as mentioned in :h :3match).

closes: vim/vim#13381

d3e277f279

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-21 18:04:08 +08:00
Maria José Solano
f1775da07f
feat(lsp): add snippet API (#25301) 2023-10-21 08:51:26 +02:00
Jorge Mederos
3304449946
fix(lsp): log unknown diagnostic tags instead of showing a warning (#25705)
To be more in line with the specification:

> To support the evolution of enumerations the using side of an enumeration shouldn’t fail on an enumeration value it doesn’t know. It should simply ignore it as a value it can use and try to do its best to preserve the value on round trips
2023-10-21 08:47:14 +02:00
zeertzjq
7a6e27958a
ci(cirrus): don't run lua/help_spec (#25498) 2023-10-21 07:21:19 +08:00
zeertzjq
ad2fad9a3b
fix(event-loop): flush UI when no input is available (#25728)
Problem:  With lots of events, UI flush may be delayed for too long.
Solution: Flush UI when no input is available. This still flushes less
          frequently than before #25629, when a flush also happens when
          typeahead buffer is empty but input is available.
2023-10-20 23:02:56 +08:00
Famiu Haque
6c87d3e0fb refactor(options): get_option_value_strict() and SREQ_*
`SREQ_*` values are now actual typedef'd enums. `get_option_value_strict()` has also been refactored and split into two functions, `get_option_attrs()` for getting the option attributes, and `get_option_value_strict()` for getting the actual value. Moreover, it now returns an `OptVal`. Other miscellaneous refactors have also been made.
2023-10-20 13:35:47 +01:00