Commit Graph

17681 Commits

Author SHA1 Message Date
zeertzjq 13ebfafc95
vim-patch:9.1.0351: No test that completing a partial mapping clears 'showcmd' (#28406)
Problem:  No test that completing a partial mapping clears 'showcmd'.
Solution: Complete partial mappings in Test_showcmd_part_map() instead
          of using :echo.  Adjust some comments (zeertzjq).

closes: vim/vim#14580

094c4390bd
2024-04-19 05:45:25 +08:00
Luna Saphie Mittelbach 345dcba629
build(windows): set longPathAware in manifest #28389
ref https://github.com/neovim/neovim/issues/28384

Allows Windows file APIs (and anything that uses them) to bypass the 260-character `MAX_PATH` limitation on Windows 10 1607 or later.

NOTE: This change by itself does not change the behaviour of running Neovim. The system must also have the Windows registry key `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled` set to a `REG_DWORD` with value 1.

See https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershell#enable-long-paths-in-windows-10-version-1607-and-later for more information.
2024-04-18 04:28:36 -07:00
zeertzjq e1ca7a7bfc
test: 'showcmd' with ext_messages and Visual selection (#28393)
Also slightly reorder some code to make comments look less out-of-place.
2024-04-18 08:33:08 +08:00
zeertzjq 562719033e
vim-patch:9.1.0343: 'showcmd' wrong for partial mapping with multibyte (#28392)
Problem:  'showcmd' is wrong for partial mapping with multibyte char,
          and isn't very readable with modifyOtherKeys.
Solution: Decode multibyte char and merge modifiers into the char.
          (zeertzjq)

This improves the following situations:
- Multibyte chars whose individual bytes are considered unprintable are
  now shown properly in 'showcmd' area.
- Ctrl-W with modifyOtherKeys now shows ^W in 'showcmd' area.

The following situation may still need improvement:
- If the char is a special key or has modifiers that cannot be merged
  into it, internal keycodes are shown in 'showcmd' area like before.
  This applies to keys typed in Normal mode commands as well, and it's
  hard to decide how to make it more readable due to the limited space
  taken by 'showcmd', so I'll leave it for later.

closes: vim/vim#14572

acdfb8a979
2024-04-18 06:23:11 +08:00
bfredl 6488a9268a
Merge pull request #28355 from theofabilous/msgpack-crash-fix
fix(msgpack): retain grid line event memory
2024-04-17 19:12:52 +02:00
dundargoc b0f9228179 docs: remove mentions of scan-build
These same checks are already checked by the clang-analyzer job, so this
duplication is not necessary.
2024-04-17 13:12:37 +02:00
zeertzjq 2f371ad7d0
vim-patch:9.1.0341: Problem: a few memory leaks are found (#28382)
Problem:  a few memory leaks are found
          (LuMingYinDetect )
Solution: properly free the memory

Fixes the following problems:
- Memory leak in f_maplist()
  fixes: vim/vim#14486

- Memory leak in option.c
  fixes: vim/vim#14485

- Memory leak in f_resolve()
  fixes: vim/vim#14484

- Memory leak in f_autocmd_get()
  related: vim/vim#14474

- Memory leak in dict_extend_func()
  fixes: vim/vim#14477
  fixes: vim/vim#14238

closes: vim/vim#14517

29269a71b5

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-04-17 06:52:29 +08:00
zeertzjq 0b2b1b0185
vim-patch:9.1.0340: Problem: Error with matchaddpos() and empty list (#28381)
Problem:  Error with matchaddpos() and empty list
          (@rickhow)
Solution: Return early for an empty list

fixes: vim/vim#14525
closes: vim/vim#14563

f7d31adcc2

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-04-17 06:49:23 +08:00
zeertzjq 329fc0e5b7
test: API can return Lua function to Lua code (#28380) 2024-04-17 06:34:10 +08:00
zeertzjq f150b62423
fix(lua): only free luarefs when returning from API (#28373) 2024-04-17 05:44:06 +08:00
Theo Fabi 60d1e3e471 fix(msgpack): store grid line event as a value 2024-04-16 16:41:13 -04:00
Luna Saphie Mittelbach 20b38677c2 feat(defaults): use ripgrep (rg) for 'grepprg' if available 2024-04-16 19:21:02 +02:00
zeertzjq 5cfdaaaeac
fix(api): ignore 'autochdir' when renaming other buf (#28376)
Problem:  Renaming non-current buffer changes working directory when
          'autochdir' is set.
Solution: Temporarily disable 'autochdir'.  Add more tests for the
          win_set_buf change.
2024-04-16 20:57:01 +08:00
Raphael 2fc2343728
fix(api): ignore 'autochdir' when setting buf in other win (#28371)
Problem:  Wrong working directory when setting buffer in another window with
          'autochdir' enabled.
Solution: Temporarily disable 'autochdir'.
2024-04-16 19:49:56 +08:00
zeertzjq 7fa24948a9
test: make mapping tests more consistent (#28368)
- Test maparg() and maplist() in the same test.
- Use matches() instead of string.match().
- Avoid overlong lines and strange spacing in exec_lua().
- Revert code change from last PR as the variable may be needed.
2024-04-16 14:05:09 +08:00
zeertzjq 47ba96a6b3
test: getting autocmd Lua callback in Vimscript (#28367)
Also remove unnecessary variable in API converter.
2024-04-16 11:59:55 +08:00
zeertzjq 60fb8a6a8b
fix(messages): avoid crash with :intro and ch=0 (#28343)
This just copies code from msg_start() to wait_return().  Not sure if
there is a better place to put such a block.
2024-04-16 10:38:17 +08:00
zeertzjq e3c083832c
vim-patch:9.1.0335: String interpolation fails for List type (#28364)
Problem:  String interpolation fails for List type
Solution: use implicit string(list) for string interpolation and :put =
          (Yegappan Lakshmanan)

related: vim/vim#14529
closes: vim/vim#14556

bce51d9005

Cherry-pick eval_to_string_eap() from patch 8.2.1914.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-04-16 10:18:24 +08:00
Gregory Anders 533e01a75b
fix(base64): properly handle embedded NULLs when decoding (#28349) 2024-04-15 11:06:54 -05:00
zeertzjq 4ec8fd43bf
fix(api): make width/height for split by nvim_open_win work (#28341) 2024-04-15 17:55:57 +08:00
zeertzjq 43f8d7e3ef
vim-patch:9.1.0329: String interpolation fails for Dict type (#28335)
Problem:  String interpolation fails for Dict type
Solution: Support Dict data type properly, also support :put =Dict
          (without having to convert it to string() first)
          (Yegappan Lakshmanan)

fixes: vim/vim#14529
closes: vim/vim#14541

f01493c550

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-04-15 07:11:39 +08:00
Sean Dewar 7180ef6901
feat(api)!: nvim_open_win: noautocmd blocks all autocmds #28192
Problem: noautocmd is confusing; despite its name, it doesn't block all
autocommands (instead it blocks only those related to setting the buffer), and
is commonly used by plugins to open windows while producing minimal
side-effects.

Solution: be consistent and block all autocommands when noautocmd is set.
This includes WinNew (again), plus autocommands from entering the window (if
enter is set) like WinEnter, WinLeave, TabEnter, .etc.

See the discussion at https://github.com/neovim/neovim/pull/14659#issuecomment-2040029517
for more information.

Remove win_set_buf's noautocmd argument, as it's no longer needed.

NOTE: pum_create_float_preview sets noautocmd for win_set_buf, but all its
callers already use block_autocmds.

Despite that, pum_create_float_preview doesn't actually properly handle
autocommands (it has no checks for whether those from win_enter or
nvim_create_buf free the window).

For now, ensure autocommands are blocked within it for correctness (in case it's
ever called outside of a block_autocmds context; the function seems to have been
refactored in #26739 anyway).
2024-04-14 16:10:16 -07:00
zeertzjq 6685481dfa
vim-patch:9.1.0320: Wrong cursor position after using setcellwidths() (#28334)
Problem:  Wrong cursor position after using setcellwidths().
Solution: Invalidate cursor position in addition to redrawing.
          (zeertzjq)

closes: vim/vim#14545

05aacec6ab

Reorder functions in test_utf8.vim to match upstream.
2024-04-15 06:11:30 +08:00
zeertzjq f6a3fdd684
refactor: fix clang NonNullParamChecker warnings (#28327) 2024-04-14 21:48:32 +08:00
zeertzjq 4c31a1b807
fix(tui): make setcellwidths() work for non-ambiwidth chars (#28322) 2024-04-14 09:29:38 +08:00
zeertzjq e81fe387d6 vim-patch:9.1.0313: Crash when using heredoc with comment in command block
Problem:  Crash when using heredoc with comment in command block.
Solution: Handle a newline more like the end of the line, fix coverity
          warning (zeertzjq).

closes: vim/vim#14535

1f5175d9af
2024-04-14 05:06:50 +08:00
zeertzjq 617a385142 vim-patch:9.1.0312: heredocs are not supported for :commands
Problem:  heredocs are not supported for :commands
          (balki)
Solution: Add heredoc support
          (Yegappan Lakshmanan)

fixes: vim/vim#14491
closes: vim/vim#14528

e74cad3321

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-04-14 05:03:31 +08:00
Raphael 3ea124a8d9
fix(float): improve error message when reconfig failed (#25076)
Problem: The current error message isn't very accurate.
Solution: Improve the error message.
2024-04-13 14:36:17 +08:00
Joey Gouly f064e72b9b
fix(path): check return value of append_path() (#28309)
If the filename passed to vim_FullName() is a relative directory, and
does not exist, it is appended to the current working directory. Since
the return value of append_path() was ignored, and if the buffer length
was too small to fit getcwd() + dirname(filename), it would still try to
append the basename(filename).

This was manifesting as a failure in test/unit/path_spec.lua in:
    itp('fails and uses filename if given filename contains non-existing directory', ..

This failure occurs when running the tests from directory with a short
path such as: /work/src/nv

    test/unit/path_spec.lua:420: Expected objects to be the same.
    Passed in:
    (string) '/work/src/nv/test.file'
    Expected:
    (string) 'non_existing_dir/test.file'

This return value for the second call to append_path() to append
basename(filename) was checked, and this is where it would fail for
normal / longer getcwd()s.
2024-04-13 11:25:55 +08:00
zeertzjq 780509aedf
fix(move): fix using the wrong window (#28312) 2024-04-13 10:32:49 +08:00
zeertzjq 4f3d018d15
vim-patch:9.0.2180: POSIX function name in exarg causes issues (#28308)
Problem:  POSIX function name in exarg struct causes issues
          on OpenVMS
Solution: Rename getline member in exarg struct to ea_getline,
          remove isinf() workaround for VMS

There are compilers that do not treat well POSIX functions - like
getline - usage in the structs.

Older VMS compilers could digest this... but the newer OpenVMS compilers
( like VSI C x86-64 X7.4-843 (GEM 50XB9) ) cannot deal with these
structs. This could be limited to getline() that is defined via
getdelim() and might not affect all POSIX functions in general - but
avoiding POSIX function names usage in the structs is a "safe side"
practice without compromising the functionality or the code readability.

The previous OpenVMS X86 port used a workaround limiting the compiler
capabilities using __CRTL_VER_OVERRIDE=80400000
In order to make the OpenVMS port future proof, this pull request
proposes a possible solution.

closes: vim/vim#13704

6fdb628082

Co-authored-by: Zoltan Arpadffy <zoltan.arpadffy@gmail.com>
2024-04-13 06:39:30 +08:00
zeertzjq 64aa0f7d0b
fix(move): check for filler lines properly (#28307)
vim-patch:9.1.0310: Filler lines not checked properly in get_scroll_overlap()
2024-04-13 06:18:45 +08:00
bfredl 8697f3274b
Merge pull request #26774 from glepnir/24129
fix(float): don't relative float win itself
2024-04-12 14:31:42 +02:00
zeertzjq 7aa56370f3
vim-patch:9.0.2114: overflow detection not accurate when adding digits (#28271)
Problem:  overflow detection not accurate when adding digits
Solution: Use a helper function

Use a helper function to better detect overflows before adding integer
digits to a long or an integer variable respectively. Signal the
overflow to the caller function.

closes: vim/vim#13539

22cbc8a4e1

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-04-11 09:34:43 +08:00
zeertzjq d0afb2dc4e
vim-patch:9.1.0297: Patch 9.1.0296 causes too many issues (#28263)
Problem:  Patch 9.1.0296 causes too many issues
          (Tony Mechelynck, chdiza, CI)
Solution: Back out the change for now

Revert "patch 9.1.0296: regexp: engines do not handle case-folding well"

This reverts commit 7a27c108e0509f3255ebdcb6558e896c223e4d23 it causes
issues with syntax highlighting and breaks the FreeBSD and MacOS CI. It
needs more work.

fixes: vim/vim#14487

c97f4d61cd

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-04-11 07:40:16 +08:00
zeertzjq f504e799a3
vim-patch:9.1.0301: Vim9: heredoc start may be recognized in string (#28266)
Problem:  Vim9: heredoc start may be recognized in string.
Solution: Don't skip to closing bracket for invalid list assignment.
          (zeertzjq)

closes: vim/vim#14472

1817ccdb10
2024-04-11 07:39:10 +08:00
Jaehwang Jung 889f81c65f
fix(drawline): don't invoke on_line for filler line (#28219)
Problem:
Decoration provider `on_line` handler is invoked for diff filler line
below the last buffer line. This does not match the documentation:
"called for each buffer line".

Solution:
Check `end_fill`.
2024-04-10 20:18:14 +08:00
glepnir 898371fc9f fix(float): don't relative flaot win itself
Problem: when reconfig current float win without win key in nvim_win_set_config will cause float win position changed when move.

Solution: don't relative itself.
2024-04-10 15:10:37 +08:00
zeertzjq 49983387ff
fix(prompt): emit change event for prompt newline (#28260)
Co-authored-by: Ilia Choly <ilia.choly@gmail.com>
2024-04-10 08:50:36 +08:00
zeertzjq f49408454d
vim-patch:9.1.0296: regexp: engines do not handle case-folding well (#28259)
Problem:  Regex engines do not handle case-folding well
Solution: Correctly calculate byte length of characters to skip

When the regexp engine compares two utf-8 codepoints case insensitively
it may match an adjacent character, because it assumes it can step over
as many bytes as the pattern contains.

This however is not necessarily true because of case-folding, a
multi-byte UTF-8 character can be considered equal to some single-byte
value.

Let's consider the pattern 'ſ' and the string 's'. When comparing and
ignoring case, the single character 's' matches, and since it matches
Vim will try to step over the match (by the amount of bytes of the
pattern), assuming that since it matches, the length of both strings is
the same.

However in that case, it should only step over the single byte
value 's' so by 1 byte and try to start matching after it again. So for the
backtracking engine we need to ensure:
- we try to match the correct length for the pattern and the text
- in case of a match, we step over it correctly

The same thing can happen for the NFA engine, when skipping to the next
character to test for a match. We are skipping over the regstart
pointer, however we do not consider the case that because of
case-folding we may need to adjust the number of bytes to skip over. So
this needs to be adjusted in find_match_text() as well.

A related issue turned out, when prog->match_text is actually empty. In
that case we should try to find the next match and skip this condition.

fixes: vim/vim#14294
closes: vim/vim#14433

7a27c108e0

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-04-10 07:08:49 +08:00
zeertzjq efb6640b29
vim-patch:9.1.0287: Vim9: comment may be treated as heredoc start (#28257)
Problem:  Vim9: comment may be treated as heredoc start.
          (Ernie Rael)
Solution: Use skip_var_list() instead of find_name_end().
          (zeertzjq)

fixes: vim/vim#14444
closes: vim/vim#14446

9a91d2b72c
2024-04-10 06:07:29 +08:00
Luuk van Baal d4956e16d9 vim-patch:9.1.0294: Text height function does not respect it's argument
Problem:  plines_m_win() does not take into account it's "limit_winheight"
          argument for filler lines below the last line of the buffer.
          (after v9.1.0280)
Solution: Check window height when "limit_winheight" is TRUE.
          (Luuk van Baal)

08b0f632c1
2024-04-09 23:43:42 +02:00
Luuk van Baal 832857ae09 vim-patch:9.1.0285: Still problems with cursor position for CTRL-D/U
Problem:  Problems with cursor position when scrolling half a page.
Solution: Rework the cursor logic. (Luuk van Baal)

78c51500f1
2024-04-09 21:44:42 +02:00
Sam 168e69ae01
fix(tui): don't set cursor color when there is none (#28236) 2024-04-09 16:05:15 +08:00
zeertzjq c695caa7ee
vim-patch:8.2.4395: some code lines not covered by tests (#28248)
Problem:    Some code lines not covered by tests.
Solution:   Add a few more test cases.  Fix getting more than one error for
            invalid assignment.

8b716f5f22

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-04-09 11:06:02 +08:00
zeertzjq 869d303043
vim-patch:8.2.0981: Vim9: cannot compile "[var, var] = list" (#28247)
Problem:    Vim9: cannot compile "[var, var] = list".
Solution:   Implement list assignment.

47a519a933

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-04-09 10:10:47 +08:00
zeertzjq 2528093bbe
vim-patch:9.1.0277: Cannot highlight the Command-line (#28244)
Problem:  Cannot highlight the Command-line
Solution: Add the MsgArea highlighting group
          (Shougo Matsushita)

closes: vim/vim#14327

be2b03c6ee

Cherry-pick Test_highlight_User() from patch 8.2.1077.

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
2024-04-09 07:20:49 +08:00
Luuk van Baal 8f5fd0884b vim-patch:9.1.0280: several issues with 'smoothscroll' support
Problem:  Logic to make sure cursor is in visible part of the screen after
          scrolling the text with 'smoothscroll' is scattered, asymmetric
          and contains bugs.
Solution: Adjust and create helper function for 'smoothscroll' cursor logic.
          (Luuk van Baal)

9148ba8a46
2024-04-09 00:51:06 +02:00
Luuk van Baal e21423bb35 vim-patch:9.1.0260: Problems with "zb" and scrolling to new topline with 'smoothscroll'
Problem: "zb" does not reveal filler lines at the start of a buffer.
          Scrolled cursor position with 'smoothscroll' is unpredictable,
          and may reset skipcol later if it is not visible (after v9.1.258)
Solution: Replace confusing for loop that reaches final control value too
          early with while loop. Set "w_curswant" accordingly so cursor
          will be placed in visible part of topline.
          (Luuk van Baal)

bd28cae1f1
2024-04-08 23:15:43 +02:00
Luuk van Baal e6cfa22c4c vim-patch:9.1.0258: half-page scrolling broke backward compatibility
Problem:  Support for 'smoothscroll' in (half-)page scrolling
          broke backward compatibility and can be made to work better.
          (after v9.1.215)
Solution: Restore the previous cursor and end-of-buffer behavior for
          half-page scrolling and improve 'smoothscroll' support.
          (Luuk van Baal)

cb204e688e
2024-04-08 23:15:43 +02:00