Commit Graph

25597 Commits

Author SHA1 Message Date
zeertzjq
af6669cd35
Merge pull request #23304 from neovim/backport-23258-to-release-0.9
[Backport release-0.9] fix(statusline): also allow right click when 'mousemodel' is "popup*"
2023-04-25 11:18:42 +08:00
Luuk van Baal
f24449d35c fix(statusline): also allow right click when 'mousemodel' is "popup*"
Problem:    The 'statusline'-format ui elements do not receive right
            click events when "mousemodel" is "popup*"
Solution:   Do not draw popupmenu and handle click event instead.
(cherry picked from commit 6b5b6e5e07)
2023-04-25 03:05:22 +00:00
zeertzjq
0c8e2d128e
Merge pull request #23300 from neovim/backport-23296-to-release-0.9
[Backport release-0.9] fix(column): don't reset 'statuscolumn' width after it has been drawn
2023-04-24 22:36:40 +08:00
Luuk van Baal
f991ddd1ab fix(column): don't reset 'statuscolumn' width after it has been drawn
Problem:     'statuscolumn' width may be reset after it has been drawn
              when multiple windows contain the same buffer. This results
              in an offset for the drawn cursor position.
Solution:     Loop over all windows (twice) prior to drawing them to
              reset the 'statuscolumn' width and validate the sign
              column when necessary.
(cherry picked from commit 89f9921a9e)
2023-04-24 14:22:31 +00:00
zeertzjq
a977c8b5fe
Merge pull request #23299 from neovim/backport-23252-to-release-0.9
[Backport release-0.9] build: include all dependency directories when generating headers
2023-04-24 17:48:35 +08:00
dundargoc
f5bf29a0ad build: include all dependency directories when generating headers
This will add all interface include directories property from all
targets to main_lib. This may not be universally wanted, in which case
we can revisit/rework it.

Closes https://github.com/neovim/neovim/issues/23237.

(cherry picked from commit 096e91b988)
2023-04-24 07:48:11 +00:00
zeertzjq
deec5e6e2a
Merge pull request #23277 from neovim/backport-23267-to-release-0.9
[Backport release-0.9] test(lsp): fix unstable tests for semantic tokens
2023-04-23 10:21:09 +08:00
John Drouhard
d6deffad57 test(lsp): fix unstable tests for semantic tokens
add screen:expect() calls after insert() to make sure the screen has
been drawn before we assert the state of the semantic tokens table

(cherry picked from commit e97b6536bb)
2023-04-23 02:02:04 +00:00
zeertzjq
d7b720f3d8
Merge pull request #23276 from neovim/backport-23210-to-release-0.9
[Backport release-0.9] fix(api): avoid assertion when autocmd group id is 0
2023-04-23 09:37:00 +08:00
Dhruv Manilawala
39ae0a0b7a fix(api): avoid assertion when autocmd group id is 0
(cherry picked from commit 3a35d7c0e8)
2023-04-23 01:23:48 +00:00
zeertzjq
f960f2621d
Merge pull request #23274 from neovim/backport-23273-to-release-0.9
[Backport release-0.9] vim-patch:9.0.1477: crash when recovering from corrupted swap file
2023-04-23 08:36:30 +08:00
zeertzjq
e937b9a9c7 vim-patch:9.0.1477: crash when recovering from corrupted swap file
Problem:    Crash when recovering from corrupted swap file.
Solution:   Check for a valid page count. (closes vim/vim#12275)

b67ba03d3e

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit dcb6b5c62d)
2023-04-23 00:24:29 +00:00
Justin M. Keyes
c52085997b
Merge pull request #23248 from neovim/backport-23234-to-release-0.9
[Backport release-0.9] fix(lua): vim.split may trim inner empty items
2023-04-21 10:20:01 -04:00
Justin M. Keyes
127a483142 refactor(lua): simplify vim.gsplit impl
(cherry picked from commit 824766612d)
2023-04-21 12:05:39 +00:00
Justin M. Keyes
2363d44d5a fix(lua): vim.split may trim inner empty items
Problem:
`vim.split('a:::', ':', {trimempty=true})` trims inner empty items.
Regression from 9c49c10470

Solution:
Set `empty_start=false` when first non-empty item is found.
close #23212

(cherry picked from commit 622b1ae38a)
2023-04-21 12:05:39 +00:00
zeertzjq
5cb6c44e30
Merge pull request #23246 from zeertzjq/backport-23225-to-release-0.9
[Backport release-0.9] fix(usercmd): fix buffer overflow in uc_list()
2023-04-21 19:52:23 +08:00
dundargoc
df3982e704
feat(checkhealth): add shims for health functions (#23241)
This is for plugins wanting to support many versions of neovim.
2023-04-21 13:39:03 +02:00
Andreas Schneider
30cfd28257 fix(usercmd): fix buffer overflow in uc_list()
Build with: -Wp,-D_FORTIFY_SOURCE=3 -O1 and gcc 13.

*** buffer overflow detected ***: terminated

(gdb) bt
  #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
  #1  0x00007f3eb8b93c03 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
  #2  0x00007f3eb8b42aee in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
  #3  0x00007f3eb8b2b87f in __GI_abort () at abort.c:79
  #4  0x00007f3eb8b2c60f in __libc_message (fmt=fmt@entry=0x7f3eb8ca72e6 "*** %s ***: terminated\n") at ../sysdeps/posix/libc_fatal.c:150
  #5  0x00007f3eb8c27b29 in __GI___fortify_fail (msg=msg@entry=0x7f3eb8ca728c "buffer overflow detected") at fortify_fail.c:24
  #6  0x00007f3eb8c26364 in __GI___chk_fail () at chk_fail.c:28
  #7  0x00007f3eb8c25f45 in ___snprintf_chk (s=s@entry=0x55b8c7c096a5 <IObuff+5> "t' item", maxlen=maxlen@entry=1025, flag=flag@entry=2, slen=slen@entry=1020, format=format@entry=0x55b8c7b872a6 "%ldc") at snprintf_chk.c:29
  #8  0x000055b8c7aea59f in snprintf (__fmt=0x55b8c7b872a6 "%ldc", __n=1025, __s=0x55b8c7c096a5 <IObuff+5> "t' item") at /usr/include/bits/stdio2.h:54
  #9  uc_list (name=name@entry=0x55b8c8351788 "Explore", name_len=name_len@entry=7) at /usr/src/debug/neovim-0.9.0-1.fc38.x86_64/src/nvim/usercmd.c:534
  #10 0x000055b8c7aeb8a0 in ex_command (eap=0x7fffdc350e60) at /usr/src/debug/neovim-0.9.0-1.fc38.x86_64/src/nvim/usercmd.c:1009
  #11 0x000055b8c7972537 in execute_cmd0 (retv=retv@entry=0x7fffdc350e54, eap=eap@entry=0x7fffdc350e60, errormsg=errormsg@entry=0x7fffdc350e58, preview=preview@entry=false) at /usr/src/debug/neovim-0.9.0-1.fc38.x86_64/src/nvim/ex_docmd.c:1620
  #12 0x000055b8c7975c55 in do_one_cmd (cmdlinep=cmdlinep@entry=0x7fffdc3510b8, flags=flags@entry=0, cstack=cstack@entry=0x7fffdc351140, fgetline=fgetline@entry=0x55b8c79882b8 <getexline>, cookie=cookie@entry=0x0) at /usr/src/debug/neovim-0.9.0-1.fc38.x86_64/src/nvim/ex_docmd.c:2279
  #13 0x000055b8c79767fe in do_cmdline (cmdline=<optimized out>, fgetline=0x55b8c79882b8 <getexline>, cookie=0x0, flags=0) at /usr/src/debug/neovim-0.9.0-1.fc38.x86_64/src/nvim/ex_docmd.c:578
  #14 0x000055b8c7a17463 in nv_colon (cap=0x7fffdc351780) at /usr/src/debug/neovim-0.9.0-1.fc38.x86_64/src/nvim/normal.c:3228
  #15 0x000055b8c7a11b35 in normal_execute (state=0x7fffdc351700, key=<optimized out>) at /usr/src/debug/neovim-0.9.0-1.fc38.x86_64/src/nvim/normal.c:1196
  #16 0x000055b8c7ab0994 in state_enter (s=0x7fffdc351700) at /usr/src/debug/neovim-0.9.0-1.fc38.x86_64/src/nvim/state.c:99
  #17 0x000055b8c7a0ef68 in normal_enter (cmdwin=false, noexmode=false) at /usr/src/debug/neovim-0.9.0-1.fc38.x86_64/src/nvim/normal.c:497
  #18 0x000055b8c78a0640 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/neovim-0.9.0-1.fc38.x86_64/src/nvim/main.c:641
2023-04-21 19:25:37 +08:00
zeertzjq
1085e91876
Merge pull request #23245 from neovim/backport-23239-to-release-0.9
[Backport release-0.9] Fix compiler warnings detected by gcc 13
2023-04-21 19:15:55 +08:00
Andreas Schneider
c0845343b6 fix(ui_client): check return code of dup()
gsrc/nvim/ui_client.c: In function ‘ui_client_start_server’:
gsrc/nvim/ui_client.c:68:5: warning: ignoring return value of ‘dup’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   68 |     dup(stderr_isatty ? STDERR_FILENO : STDOUT_FILENO);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(cherry picked from commit 4d654472e6)
2023-04-21 11:06:22 +00:00
Andreas Schneider
a99d5d17d5 fix(statusline): fix uninitialized variable and possible overflow
In file included from /usr/include/string.h:535,
                 from gsrc/nvim/statusline.c:10:
In function ‘strcat’,
    inlined from ‘build_stl_str_hl’ at gsrc/nvim/statusline.c:1688:9:
/usr/include/bits/string_fortified.h:130:10: warning: ‘p’ may be used uninitialized [-Wmaybe-uninitialized]
  130 |   return __builtin___strcat_chk (__dest, __src, __glibc_objsize (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(cherry picked from commit 54f5602038)
2023-04-21 11:06:22 +00:00
Andreas Schneider
a77a8a9934 fix(linematch): initialize array
gsrc/nvim/linematch.c: In function ‘try_possible_paths’:
gsrc/nvim/linematch.c:204:35: warning: ‘from_vals’ may be used uninitialized [-Wmaybe-uninitialized]
  204 |       size_t unwrapped_idx_from = unwrap_indexes(from_vals, diff_len, ndiffs);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(cherry picked from commit f5530bf566)
2023-04-21 11:06:22 +00:00
Andreas Schneider
6b32fe96b0 fix(ex_getln): initialize pointer with NULL
In function ‘cmdpreview_open_win’,
    inlined from ‘cmdpreview_may_show’ at gsrc/nvim/ex_getln.c:2487:28:
gsrc/nvim/ex_getln.c:2251:16: warning: ‘cmdpreview_buf’ may be used uninitialized [-Wmaybe-uninitialized]
 2251 |   int result = do_buffer(DOBUF_GOTO, DOBUF_FIRST, FORWARD, cmdpreview_buf->handle, 0);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(cherry picked from commit a114a21eff)
2023-04-21 11:06:22 +00:00
Andreas Schneider
6ba14ff182 fix(userfunc): fix possible out of bound access
In file included from /usr/include/string.h:535,
                 from gsrc/nvim/eval/userfunc.c:11:
In function ‘strcpy’,
    inlined from ‘cat_func_name’ at gsrc/nvim/eval/userfunc.c:662:5,
    inlined from ‘get_user_func_name’ at gsrc/nvim/eval/userfunc.c:2854:5:
/usr/include/bits/string_fortified.h:79:10: warning: ‘__builtin___strcpy_chk’ offset 0 from the object at ‘<unknown>’ is out of the bounds of referenced subobject ‘uf_name’ with ty
pe ‘char[]’ at offset 0 [-Warray-bounds=]
   79 |   return __builtin___strcpy_chk (__dest, __src, __glibc_objsize (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from gsrc/nvim/eval/typval.h:10,
                 from gsrc/nvim/buffer_defs.h:20,
                 from gsrc/nvim/autocmd.h:8,
                 from gsrc/nvim/eval/userfunc.c:15:
gsrc/nvim/eval/typval_defs.h: In function ‘get_user_func_name’:
gsrc/nvim/eval/typval_defs.h:342:8: note: subobject ‘uf_name’ declared here
  342 |   char uf_name[];    ///< Name of function (actual size equals name);
      |        ^~~~~~~

(cherry picked from commit 9802de9334)
2023-04-21 11:06:22 +00:00
Andreas Schneider
6bd73ed2d9 fix(drawline): initialize variable
src/nvim/drawline.c: In function ‘win_line’:
src/nvim/drawline.c:1418:16: warning: ‘charsize’ may be used uninitialized [-Wmaybe-uninitialized]
 1418 |       wlv.vcol -= charsize;
      |                ^~

(cherry picked from commit 2819718873)
2023-04-21 11:06:22 +00:00
Andreas Schneider
b91278c4fa fix(drawline): initialize variable
src/nvim/drawline.c: In function ‘draw_virt_text’:
src/nvim/drawline.c:298:28: warning: ‘col’ may be used uninitialized [-Wmaybe-uninitialized]
  298 |       state->eol_col = col + 1;
      |                        ~~~~^~~

(cherry picked from commit e9280a68f7)
2023-04-21 11:06:22 +00:00
Andreas Schneider
b2a43b5287 fix(api): avoid integer truncation
gsrc/nvim/api/vim.c: In function ‘nvim_eval_statusline’:
gsrc/nvim/api/vim.c:2268:55: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 2 [-Wformat-tru
ncation=]
 2268 |         snprintf(user_group, sizeof(user_group), "User%d", sp->userhl);
      |                                                       ^~
gsrc/nvim/api/vim.c:2268:50: note: directive argument in the range [1, 2147483647]
 2268 |         snprintf(user_group, sizeof(user_group), "User%d", sp->userhl);
      |                                                  ^~~~~~~~
In file included from /usr/include/stdio.h:906,
                 from gsrc/nvim/api/vim.c:9:
In function ‘snprintf’,
    inlined from ‘nvim_eval_statusline’ at gsrc/nvim/api/vim.c:2268:9:
/usr/include/bits/stdio2.h:54:10: note: ‘__builtin___snprintf_chk’ output between 6 and 15 bytes into a destination of size 6
   54 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   55 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   56 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~

(cherry picked from commit ef7ae66eef)
2023-04-21 11:06:22 +00:00
zeertzjq
400bf2851a
Merge pull request #23244 from neovim/backport-23187-to-release-0.9
[Backport release-0.9] fix(column): rebuild status column when sign column is invalid
2023-04-21 18:59:31 +08:00
Luuk van Baal
a5d8024b24 fix(column): rebuild status column when sign column is invalid
(cherry picked from commit 44d4f03573)
2023-04-21 10:46:50 +00:00
Luuk van Baal
2d3c825ada test(column): statuscolumn is rebuild when signs are (un)placed
(cherry picked from commit d799456a6b)
2023-04-21 10:46:50 +00:00
github-actions[bot]
ef7513c87f
[Backport release-0.9] fix(treesitter playground): fix the wrong range of a node displayed i… (#23220)
fix(treesitter playground): wrong range of a node displayed in playground

The call parameters order of the function `get_range_str` is flipped for the last two arguments compared to the declaration.

(cherry picked from commit 8613ba118c)

Co-authored-by: William <50717946+BIKA-C@users.noreply.github.com>
2023-04-20 18:30:56 +02:00
github-actions[bot]
9cb2f2fc31
[Backport release-0.9] fix(runtime): do not allow breakcheck inside runtime path calculation (#23201)
fix(runtime): do not allow breakcheck inside runtime path calculation

problem: breakcheck might run arbitrary lua code, which might require
modules and thus invoke runtime path calculation recursively.
solution: Block the use of breakcheck when expanding glob patterns
inside 'runtimepath'

fixes #23012

(cherry picked from commit aee6f08ce1)

Co-authored-by: bfredl <bjorn.linse@gmail.com>
2023-04-19 17:19:59 +02:00
github-actions[bot]
a41930bcf0
[Backport release-0.9] fix(watchfiles): skip Created events when poll starts (#23197)
fix(watchfiles): skip Created events when poll starts

(cherry picked from commit 8ca1bae217)

Co-authored-by: Jon Huhn <huhnjon@gmail.com>
2023-04-19 16:55:06 +02:00
zeertzjq
fa5fe845cc
Merge pull request #23193 from neovim/backport-23192-to-release-0.9
[Backport release-0.9] test(terminal/channel_spec): fix screen test immediate success
2023-04-19 12:20:21 +08:00
zeertzjq
30581744e4 test(terminal/channel_spec): fix screen test immediate success
Check for the [No Name] after wiping the buffer.

(cherry picked from commit 954fe75eab)
2023-04-19 04:10:23 +00:00
github-actions[bot]
535d8553c4
[Backport release-0.9] fix(loader): reset hashes when running the loader (#23181)
fix(loader): only keep hashes for the current loop iteration

(cherry picked from commit e12cfa567f)

Co-authored-by: Lewis Russell <lewis6991@gmail.com>
2023-04-18 17:08:45 +02:00
zeertzjq
40ef3b2bd4
Merge pull request #23180 from neovim/backport-23179-to-release-0.9
[Backport release-0.9] fix(api): extmark highlight groups not always included in details
2023-04-18 21:20:57 +08:00
Luuk van Baal
54f930f4e3 fix(api): extmark highlight groups not always included in details
Problem:    Erroneous for loop condition.
Solution:   Remove for loop condition.
(cherry picked from commit 5d97d61eab)
2023-04-18 13:08:35 +00:00
Sean Dewar
37a44f3247
Merge pull request #23174 from neovim/backport-23005-to-release-0.9
[Backport release-0.9] fix(ruler): fix some ruler issues with no statusline
2023-04-18 10:14:21 +01:00
Sean Dewar
470aa2dbf9 fix(ruler): show ruler of curwin with no statusline in cmdline
Problem: After neovim/neovim@846a056, only the ruler for current floating or
last window without a statusline is drawn in the cmdline. This means that if the
current window is not one of these, but has no statusline, its ruler will not be
drawn anymore.

Solution: Make `showmode()` draw the ruler of the current window or the last
window in the cmdline if it has no statusline. This also maintains the
previously restored floating window case (`float->w_status_height` should be 0).

This behaviour should again match Vim, but without the overdraw it seems to do
to achieve the same effect; it calls `showmode()` to draw the ruler for the last
window without a statusline, then may draw over it in `showruler()` (which is
now `show_cursor_info_later()` in Nvim) to show the ruler for the current
window..? It's very confusing.

Also update the logic in `win_redr_ruler()` to mirror the check done in
`showmode()`, so that the ruler doesn't potentially draw over the long
ins-completion mode message in some cases.

(cherry picked from commit 65dd3c1180)
2023-04-18 09:02:02 +00:00
Sean Dewar
ba198bd7cc vim-patch:9.0.1461: ruler not drawn correctly when using 'rulerformat'
Problem:    Ruler not drawn correctly when using 'rulerformat'.
Solution:   Adjust formatting depending on whether the ruler is drawn in the
            statusline or the command line. (Sean Dewar, closes vim/vim#12246)

fc8a601c32

This issue was made apparent after neovim/neovim@0f1e2b6, as `showmode()` calls
`win_redr_ruler()` with `curwin` now if it's floating, rather than the last
window if there's no statusline (which usually already shares its right side
with that of the editor).

Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
(cherry picked from commit 7095f8ff9d)
2023-04-18 09:02:02 +00:00
zeertzjq
96de6bbaad
Merge pull request #23169 from neovim/backport-23163-to-release-0.9
[Backport release-0.9] fix(mouse): cmdline click registered as statuscolumn
2023-04-18 08:19:10 +08:00
Luuk van Baal
54c6dfa009 fix(mouse): cmdline click registered as statuscolumn
(cherry picked from commit dea3774def)
2023-04-18 00:01:09 +00:00
zeertzjq
8e2af977b1
Merge pull request #23160 from neovim/backport-23159-to-release-0.9
[Backport release-0.9] vim-patch:9.0.1460: insufficient testing for getcmdcompltype()
2023-04-17 23:39:22 +08:00
zeertzjq
fc545cb008 vim-patch:9.0.1460: insufficient testing for getcmdcompltype()
Problem:    Insufficient testing for getcmdcompltype().
Solution:   Add a few more test cases. (closes vim/vim#12268)

961b2e54bd
(cherry picked from commit 56472e5262)
2023-04-17 15:27:23 +00:00
zeertzjq
42199afc14
Merge pull request #23147 from neovim/backport-23146-to-release-0.9
[Backport release-0.9] vim-patch:9.0.1400: find_file_in_path() is not reentrant
2023-04-17 14:58:31 +08:00
zeertzjq
c9f1e6837a vim-patch:9.0.1400: find_file_in_path() is not reentrant
Problem:    find_file_in_path() is not reentrant.
Solution:   Instead of global variables pass pointers to the functions.
            (closes vim/vim#12093)

5145c9a829

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit 7b8daa25cd)
2023-04-17 06:39:18 +00:00
zeertzjq
1103a4c2c6
Merge pull request #23130 from neovim/backport-23098-to-release-0.9
[Backport release-0.9] fix(lua): inspect_pos respect bufnr when get syntax info
2023-04-16 18:13:36 +08:00
Raphael
79ee63bc36 fix(lua): inspect_pos respect bufnr when get syntax info
(cherry picked from commit ee4d1f9c52)
2023-04-16 09:50:49 +00:00
zeertzjq
6b88a9555c
Merge pull request #23089 from neovim/backport-22968-to-release-0.9
[Backport release-0.9] fix(api): update "w_scwidth" in nvim_eval_statusline()
2023-04-14 21:31:49 +08:00