Commit Graph

5517 Commits

Author SHA1 Message Date
zeertzjq
1cb46abff1
vim-patch:9.0.1475: busted configuration files are not recognized (#23266)
Problem:    Busted configuration files are not recognized.
Solution:   Recognize busted configuration files as Lua. (Craig MacEachern,
            closes vim/vim#12209)

Co-authored-by: C.D. MacEachern <craig.daniel.maceachern@gmail.com>
2023-04-22 23:51:53 +08:00
T727
d9f78b6336
docs(powershell): use tee.exe instead of Tee-Object
Problem: Tee-Object does not create a file if it does not receive input
for example when :grep does not find matches.
and so nvim tries to open a nonexistent errorfile causing an error.

Solution: use tee.exe instead of Tee-Object
2023-04-22 12:04:05 +02:00
Gregory Anders
f68af3c3bc
refactor(iter): use metatable as packed table tag (#23254)
This is a more robust method for tagging a packed table as it completely
eliminates the possibility of mistaking an actual table key as the
packed table tag.
2023-04-21 16:13:39 -06:00
Justin M. Keyes
622b1ae38a 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
2023-04-21 13:50:22 +02:00
Andreas Schneider
9e79f7433e
fix(usercmd): Fix buffer overflow in uc_list() (#23225)
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:16:32 +08:00
Lewis Russell
3e41121e86
Merge pull request #23187 from luukvbaal/statuscolumn
fix(column): rebuild status column when sign column is invalid
2023-04-21 11:46:30 +01:00
zeertzjq
f1b415b3ab
vim-patch:9.0.1472: ":drop fname" may change the last used tab page (#23230)
Problem:    ":drop fname" may change the last used tab page.
Solution:   Restore the last used tab page when :drop has changed it.
            (closes vim/vim#12087)

8281a16efc

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-21 09:02:30 +08:00
zeertzjq
dbcd1985d1
vim-patch:8.2.4598: profile completion test sometimes fails (#23208)
Problem:    Profile completion test sometimes fails.
Solution:   Delete the .res file before running tests.

7e0be3ea21

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-20 09:17:33 +08:00
Gregory Anders
0ad5237162
Merge pull request #23198 from gpanders/iter-fix
fix(iter): allow table values in iterator pipelines
2023-04-19 08:23:42 -06:00
zeertzjq
0d7bed34a2
vim-patch:9.0.1470: deferred functions invoked in unexpected order (#23199)
Problem:    Deferred functions invoked in unexpected order when using :qa and
            autocommands.
Solution:   Call deferred functions for the current funccal before using the
            stack. (closes vim/vim#12278)

1be4b81bfb
2023-04-19 22:09:48 +08:00
Gregory Anders
9489406879 fix(iter): remove special case totable for map-like tables
This was originally meant as a convenience but prevents possible
functionality. For example:

  -- Get the keys of the table with even values
  local t = { a = 1, b = 2, c = 3, d = 4 }
  vim.iter(t):map(function(k, v)
    if v % 2 == 0 then return k end
  end):totable()

The example above would not work, because the map() function returns
only a single value, and cannot be converted back into a table (there
are many such examples like this).

Instead, to convert an iterator into a map-like table, users can use
fold():

  vim.iter(t):fold({}, function(t, k, v)
    t[k] = v
    return t
  end)
2023-04-19 07:52:04 -06:00
Gregory Anders
6b96122453 fix(iter): add tag to packed table
If pack() is called with a single value, it does not create a table; it
simply returns the value it is passed. When unpack is called with a
table argument, it interprets that table as a list of values that were
packed together into a table.

This causes a problem when the single value being packed is _itself_ a
table. pack() will not place it into another table, but unpack() sees
the table argument and tries to unpack it.

To fix this, we add a simple "tag" to packed table values so that
unpack() only attempts to unpack tables that have this tag. Other tables
are left alone. The tag is simply the length of the table.
2023-04-19 07:04:49 -06:00
zeertzjq
14caad32b6 test: convert tests in test_conceal.vim to Lua 2023-04-19 16:23:08 +08:00
zeertzjq
8bed07357d vim-patch:9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Problem:    'cursorcolumn' and 'colorcolumn' wrong after concealing and
            wrapping line.
Solution:   Reset "wlv.vcol_off" after each screen line. (Alexey Radkov,
            closes vim/vim#11777)

aaa16b0918

Cherry-pick test_conceal.vim changes from patches 8.2.4339, 9.0.0418.

Co-authored-by: Alexey Radkov <alexey.radkov@gmail.com>
2023-04-19 16:23:08 +08:00
Christian Clason
cff02e993d
vim-patch:9.0.1467: Jenkinsfiles are not recognized as groovy (#23195)
Problem:    Jenkinsfiles are not recognized as groovy.
Solution:   Add a pattern for Jenkinsfiles. (closes vim/vim#12236)

142ffb024d

Co-authored-by: dundargoc <gocdundar@gmail.com>
2023-04-19 10:19:33 +02:00
Christian Clason
6d9f5b6bf0
vim-patch:9.0.1464: strace filetype detection is expensive (#23175)
Problem:    Strace filetype detection is expensive.
Solution:   Match with a cheap pattern first. (Federico Mengozzi,
            closes vim/vim#12220)

6e5a9f9482

Co-authored-by: Federico Mengozzi <19249682+fedemengo@users.noreply.github.com>
2023-04-19 09:41:26 +02:00
zeertzjq
95c6e1b741
test(terminal/channel_spec): fix screen test immediate success (#23192)
Check for the [No Name] after wiping the buffer.
2023-04-19 12:10:06 +08:00
zeertzjq
519acb3ec1 vim-patch:9.0.1034: reporting swap file when windows are split
Problem:    Reporting swap file when windows are split.
Solution:   Close extra windows after running a test.

e5eae82bb7

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjq
b9bf1b1294 vim-patch:9.0.1021: test trips over g:name
Problem:    Test trips over g:name.
Solution:   Delete g:name after using it.

d6e74f5479

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjq
5f4e0a005b vim-patch:9.0.1020: tests call GetSwapFileList() before it is defined
Problem:    Tests call GetSwapFileList() before it is defined.
Solution:   Move the call to after defining the function. (Christopher
            Plewright)

6572a90287

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjq
ab7bd119d7 vim-patch:9.0.1012: tests may get stuck in buffer with swap file
Problem:    Tests may get stuck in buffer with swap file.
Solution:   Bail out when bwipe! doesn't get another buffer.

fa2533c8bb

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjq
a2f4bad781 vim-patch:9.0.1010: stray warnings for existing swap files
Problem:    Stray warnings for existing swap files.
Solution:   Wipe out the buffer until it has no name and no swap file.

23526d2539

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjq
a0d4649c17 vim-patch:9.0.1009: test for catch after interrupt is flaky on MS-Windows
Problem:    Test for catch after interrupt is flaky on MS-Windows.
Solution:   Mark the test as flaky.

72b5b0d51a

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjq
94a7ccea43 vim-patch:9.0.1008: test for swapfilelist() fails on MS-Windows
Problem:    Test for swapfilelist() fails on MS-Windows.
Solution:   Only check the tail of the path.  Mark a test as flaky.

6cf3151f0e

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjq
85c61d6716 vim-patch:9.0.1007: there is no way to get a list of swap file names
Problem:    There is no way to get a list of swap file names.
Solution:   Add the swapfilelist() function.  Use it in the test script to
            clean up.  Remove deleting individual swap files.

c216a7a21a

vim-patch:9.0.1005: a failed test may leave a swap file behind

Problem:    A failed test may leave a swap file behind.
Solution:   Delete the swap file to avoid another test to fail.  Use another
            file name.

d0f8d39d20

Cherry-pick test_window_cmd.vim changes from patch 8.2.1593.
Remove FUNC_ATTR_UNUSED from eval functions as fptr is always unused.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjq
d82a6ca72a vim-patch:9.0.0561: when a test gets stuck it just hangs forever
Problem:    When a test gets stuck it just hangs forever.
Solution:   Set a timeout of 30 seconds.

3bcd0ddc2d

Note: This doesn't cause test_timers.vim failures in Nvim because there
is a SetUp() function that calls timer_stopall().

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjq
63432c854f vim-patch:9.0.0560: elapsed time since testing started is not visible
Problem:    Elapsed time since testing started is not visible.
Solution:   Show the elapsed time while running tests.

b9093d5009

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjq
7592540029 vim-patch:9.0.0545: when a test is slow and CI times out there is no time info
Problem:    When a test is slow and CI times out there is no time info.
Solution:   Add the elapsed time to the "Executing" message.

daaa3d9965

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjq
db12c61c56 vim-patch:9.0.0514: terminal test sometimes hangs
Problem:    Terminal test sometimes hangs.
Solution:   Add a bit more information to the test output. (issue vim/vim#11179)

a22c56a59a

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjq
ad06c1c1c6 vim-patch:9.0.0426: failed flaky tests reports only start time
Problem:    Failed flaky tests reports only start time.
Solution:   Also report the end time.

65258d36dd

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjq
c4c5bcd2b2 vim-patch:9.0.0372: MS-Windows: "%T" time format does not appear to work
Problem:    MS-Windows: "%T" time format does not appear to work.
Solution:   Use "%H:%M:%S" instead.

5fbbec180b

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjq
db6812c444 vim-patch:9.0.0369: a failing flaky test doesn't mention the time
Problem:    A failing flaky test doesn't mention the time.
Solution:   Add the time for debugging.  Improve error message.

06d32a0c17

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:33 +08:00
Luuk van Baal
44d4f03573 fix(column): rebuild status column when sign column is invalid 2023-04-19 03:22:27 +02:00
zeertzjq
a0c982671e vim-patch:9.0.1469: deferred functions not called from autocommands
Problem:    Deferred functions not called from autocommands.
Solution:   Also go through the funccal_stack. (closes vim/vim#12267)

960cf9119e
2023-04-19 08:09:46 +08:00
zeertzjq
a11849abdf vim-patch:9.0.1468: recursively calling :defer function if it does :qa
Problem:    Recursively calling :defer function if it does :qa in a compiled
            function.
Solution:   Clear the defer entry before calling the function. (closes vim/vim#12271)

a1f2b5ddc6
2023-04-19 08:09:46 +08:00
zeertzjq
8e0ad6e261 vim-patch:9.0.1462: recursively calling :defer function if it does :qa
Problem:    Recursively calling :defer function if it does :qa.
Solution:   Clear the defer entry before calling the function. (closes vim/vim#12266)

42994bf678

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 08:09:46 +08:00
Luuk van Baal
d799456a6b test(column): statuscolumn is rebuild when signs are (un)placed 2023-04-19 01:09:45 +02:00
luukvbaal
59fed8bb64
fix(api): extmark highlight groups not always included in details (#23179)
Problem:    Erroneous for loop condition.
Solution:   Remove for loop condition.
2023-04-18 21:07:37 +08:00
Sean Dewar
9033d5eccc
Merge pull request #23005 from seandewar/fix-ruf-cmdline-pos
fix(ruler): fix some ruler issues with no statusline
2023-04-18 10:01:42 +01:00
zeertzjq
9180c18c46 vim-patch:9.0.0864: crash when using "!!" without a previous shell command
Problem:    Crash when using "!!" without a previous shell command.
Solution:   Check "prevcmd" is not NULL. (closes vim/vim#11487)

6600447c7b

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-18 14:35:04 +08:00
zeertzjq
187ba3efce vim-patch:9.0.0815
9c50eeb401

Co-authored-by: Martin Tournoij <martin@arp242.net>
2023-04-18 14:29:07 +08:00
zeertzjq
c0f10d3fe0 vim-patch:9.0.0783: ":!" doesn't do anything but does update the previous command
Problem:    ":!" doesn't do anything but does update the previous command.
Solution:   Do not have ":!" change the previous command. (Martin Tournoij,
            closes vim/vim#11372)

8107a2a8af

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-18 14:20:44 +08:00
luukvbaal
84a4319545
fix(mouse): cmdline click registered as statuscolumn (#23163) 2023-04-18 08:00:49 +08:00
Gregory Anders
ab1edecfb7
feat(lua): add vim.iter (#23029)
vim.iter wraps a table or iterator function into an `Iter` object with
methods such as `filter`, `map`, and `fold` which can be chained to
produce iterator pipelines that do not create new tables at each step.
2023-04-17 12:54:19 -06:00
Sean Dewar
65dd3c1180
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.
2023-04-17 18:40:12 +01:00
Sean Dewar
7095f8ff9d
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>
2023-04-17 18:38:31 +01:00
Jon Huhn
6cc76011ca
fix(watchfiles): skip Created events when poll starts (#23139) 2023-04-17 18:50:05 +02:00
zeertzjq
9e5f9c25d9
vim-patch:9.0.1460: insufficient testing for getcmdcompltype() (#23159)
Problem:    Insufficient testing for getcmdcompltype().
Solution:   Add a few more test cases. (closes vim/vim#12268)

961b2e54bd
2023-04-17 23:27:04 +08:00
Isak Samsten
07b60efd80
feat(diagnostic): specify diagnostic virtual text prefix as a function
- vim.diagnostic.config() now accepts a function for the virtual_text.prefix
  option, which allows for rendering e.g., diagnostic severities differently.
2023-04-17 12:53:34 +01:00
zeertzjq
75d9c413d4
fix(excmd): make :def unknown rather than unimplemented (#23150) 2023-04-17 17:44:08 +08:00