Problem: Crash with weird 'vartabstop' value.
Solution: Check for running into the end of the line.
4e889f98e9
Code change is N/A as it's superseded by virtual text changes.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: minor issues in test_filetype with rasi test
(after 9.1.0453)
Solution: re-sort test_filetype, fix wrong syntax.txt help tags
f3dd6f617c
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: rasi files are not recognized
Solution: regonize '*.rasi' files as rasi filetype,
include a filetype and syntax plugin
(Pierrick Guillaume)
ported from: https://github.com/Fymyte/rasi.vimcloses: vim/vim#14821280e5b13ca
Co-authored-by: Pierrick Guillaume <pierguill@gmail.com>
Problem: No test for escaping '<' with shellescape()
Solution: Add a test. Use memcpy() in code to make it easier to
understand. Fix a typo (zeertzjq).
closes: vim/vim#1487688c8c547d5
Problem: Testing the shell option is incomplete and spread out.
Solution: Move shell tests to one file and increase coverage. (Yegappan
Lakshmanan, closesvim/vim#8464)
054794c20f
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
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#14851ef73374dc3
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#14842afc2295c22
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>
Problem: Cannot filter the history
Solution: Implement :filter :history
closes: vim/vim#1483542a5b5a6d0
Co-authored-by: Christian Brabandt <cb@256bit.org>
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#148382b09de9104
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#148373074137542
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#14830701ad50a9e
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#1482552a6f34887
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>
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#1481742cd192daa
Cherry-pick Test_tagbsearch() changes from patch 9.0.0767.
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#14734closes: vim/vim#14735d5c8c0920e
Co-authored-by: Christian Brabandt <cb@256bit.org>
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#14805c95e64f41f
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#14609closes: vim/vim#14617b4757e627e
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Problem: Cannot move to previous/next rare word
(Colin Kennedy)
Solution: Add the ]r and [r motions (Christ van Willegen)
fixes: vim/vim#14773closes: vim/vim#147808e4c4c7d87
Co-authored-by: Christ van Willegen - van Noort <github.com@vanwillegen-vannoort.nl>
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
Problem: smoothscroll may cause infinite loop, with
very narrow windows
(Jaehwang Jung, after v9.1.0280)
Solution: Check for width1 being negative, verify
that win_linetabsize does not overflow
fixes: vim/vim#14750closes: vim/vim#14772eff20eb35d
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: No scrolling happens with half-page scrolling with line
filling entire window when 'smoothscroll' is disabled.
(Mathias Rav, after v9.1.0285)
Solution: Adjust amount to move cursor by so that it is moved the same
number of lines as was scrolled, even when scrolling different
number of lines than requested with 'nosmoothscroll'.
58448e09be
Problem: Divide by zero with getmousepos() and 'smoothscroll'.
Solution: Don't compute skip_lines when width1 is zero.
(zeertzjq)
closes: vim/vim#14747031a745608
Problem: filetype: zsh module files are not recognized
Solution: Detect '*.mdh' and '*.epro' as C filetype, '*.mdd' as zsh
filetype, determine zsh-modules '*.pro' from from it's content
(Wu, Zhenyu)
closes: vim/vim#14737887a38cee7
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Problem: Wrong display with 'smoothscroll' when changing quickfix list.
Solution: Reset w_skipcol when replacing quickfix list (zeertzjq).
closes: vim/vim#14730c7a8eb5ff2
Problem: cursor() and getregion() don't handle v:maxcol well.
Solution: Add special handling for v:maxcol like setpos() does.
(zeertzjq)
closes: vim/vim#146982ffdae7948
Problem: filetype: stylus files not recognized
Solution: Detect '*.styl' and '*.stylus' as stylus filetype,
include indent, filetype and syntax plugin
(Philip H)
closes: vim/vim#146562d919d2744
Co-authored-by: Philip H <47042125+pheiduck@users.noreply.github.com>
Problem: filetype: .out files recognized as tex files
Solution: Do not set an explicit filetype until it is clear what this
should be (shane.xb.qian)
closes: vim/vim#14670e35478bc9d
Co-authored-by: shane.xb.qian <shane.qian@foxmail.com>
Problem: Kbuild files are not recognized.
Solution: Detect Kbuild files as make files.
(Bruno Belanyi)
closes: vim/vim#146765cbc9a69e5
Co-authored-by: Bruno BELANYI <bruno@belanyi.fr>
Problem: cbuffer and similar quickfix and locationlist commands don't
accept a range, even so it is documented they should
(ilan-schemoul, after 8.1.1241)
Solution: Define ex commands with ADDR_LINES instead of ADDR_OTHER
fixes: vim/vim#14638closes: vim/vim#14657652c821366
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: When :edit an existing buffer, line('w$') may return a
wrong result.
Solution: Reset w_valid in curwin_init() (Jaehwang Jung)
`do_ecmd()` reinitializes the current window (`curwin_init()`) whose
`w_valid` field may have `VALID_BOTLINE` set. Resetting `w_botline`
without marking it as invalid makes subsequent `validate_botline()`
calls a no-op, thus resulting in wrong `line('w$')` value.
closes: vim/vim#14642eb80b8304e
Co-authored-by: Jaehwang Jung <tomtomjhj@gmail.com>
Specifically, functions that are run in the context of the test runner
are put in module `test/testutil.lua` while the functions that are run
in the context of the test session are put in
`test/functional/testnvim.lua`.
Closes https://github.com/neovim/neovim/issues/27004.
Problem: tests: test_vim9_builtin is a bit slow
Solution: source tests from a buffer instead of
writing and sourcing a file (Yegappan Lakshmanan)
closes: vim/vim#1461422697b6179
N/A patch:
vim-patch:9.1.0299: Vim9: return type not set for a lambda assigned to script var
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: Crash when typing many keys with D- modifier (after 9.1.0227).
Solution: Don't treat a 0x80 byte inside a special sequence as the start
of a special sequence (zeertzjq).
closes: vim/vim#146136b13e3d4e4
Problem: Page scrolling does not always place the cursor at the top or
bottom of the window (Mathias Rav)
Solution: Place the cursor at the top or bottom of the window.
(Luuk van Baal)
4b6b0c4024
Problem: tests: test_winfixbuf is a bit slow
Solution: use defer if possible, reset hidden option, use --not-a-term
when starting Vim using system() (Yegappan Lakshmanan)
closes: vim/vim#146114baf908d60
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: runtime(uci): No support for uci file types
(Wu, Zhenyu)
Solution: include basic uci ftplugin and syntax plugins
(Colin Caine)
closes: vim/vim#145754b3fab14db
Co-authored-by: Colin Caine <complaints@cmcaine.co.uk>
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
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#14580094c4390bd
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#14572acdfb8a979
Problem: Cursor wrong after using setcellwidth() in terminal
(mikoto2000)
Solution: output additional spaces, so the behaviour matches the GUI
(mikoto2000)
fixes: vim/vim#14539closes: vim/vim#14540
Fix CUI `setcellwidths` characters draw behavior to same GUI behavior.
e20fa59903
This is already fixed and tested in Nvim in #28322.
Co-authored-by: mikoto2000 <mikoto2000@gmail.com>
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#14477fixes: vim/vim#14238closes: vim/vim#1451729269a71b5
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Error with matchaddpos() and empty list
(@rickhow)
Solution: Return early for an empty list
fixes: vim/vim#14525closes: vim/vim#14563f7d31adcc2
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: String interpolation fails for List type
Solution: use implicit string(list) for string interpolation and :put =
(Yegappan Lakshmanan)
related: vim/vim#14529closes: vim/vim#14556bce51d9005
Cherry-pick eval_to_string_eap() from patch 8.2.1914.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: filetype: some requirements files are not recognized
Solution: Detect '*-requirements.txt', 'constraints.txt',
'requirements.in', 'requirements/*.txt' and 'requires/*.txt'
as requirements filetype, include pip compiler, include
requirements filetype and syntax plugin
(Wu, Zhenyu, @raimon49)
closes: vim/vim#14379f9f5424d3e
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Co-authored-by: raimon <raimon49@hotmail.com>
Problem: Vim9: Not all function argument types are properly checked.
Solution: Add and improve argument type checks. (Yegappan Lakshmanan,
closesvim/vim#8839)
fc3b775055
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: filetype: some mail tools not recognized
Solution: Detect '.mbsncrc' as conf, '.msmtprc' as msmtp
and '.notmuch-config' as ini filetype
(Shane-XB-Qian)
closes: vim/vim#14533a7a9a476cf
Co-authored-by: shane.xb.qian <shane.qian@foxmail.com>
Problem: No test for highlight behavior with 'ambiwidth'.
Solution: Add a screendump test for 'ambiwidth' with 'cursorline'.
(zeertzjq)
closes: vim/vim#14554a59e031aa0
Problem: CI fails with t_?? test
Solution: use assert_match instead of assert_equal
and test only until t_xo, depending on system
there may be several more termcap codes coming
0d87e3c711
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: When used terminal with XON/XOFF flow control, vim tries to
still make CTRL-S mapping available, which results in severe
screen corruption, especially on large redraws, and even
spurious inputs (John Tsiombikas)
Solution: Disallow CTRL-S mapping if such terminal is recognized.
Don't remove IXON from the bitmask inversion.
(Anton Sharonov)
*** When started like this:
TERM=vt420 vim
:set termcap
shows "t_xon=y"
map <C-S> :echo "abc"<CR>
does nothing (after <C-S> output freezes and subsequent <C-Q>
unfreezes it)
*** When started like this:
TERM=xterm vim
:set termcap
shows "t_xon="
map <C-S> :echo "abc"<CR>
works (after <C-S> one see "abc" string echo-ed)
fixes: vim/vim#12674closes: vim/vim#1454249528da8a6
Co-authored-by: Anton Sharonov <anton.sharonov@gmail.com>
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#14529closes: vim/vim#14541f01493c550
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: Wrong cursor position after using setcellwidths().
Solution: Invalidate cursor position in addition to redrawing.
(zeertzjq)
closes: vim/vim#1454505aacec6ab
Reorder functions in test_utf8.vim to match upstream.
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#145351f5175d9af
Problem: filetype: some history files are not recognized
Solution: Add some history patterns to filetype.vim
(Wu, Zhenyu)
closes: vim/vim#14513da70feabea
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Problem: filetype: xilinx files are not recognized
Solution: Add a few xilinx specific file patterns,
inspect lpr files for being xml/pascal
(Wu, Zhenyu)
closes: vim/vim#14454614691ceef
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Problem: filetype: some TeX files are not recognized
Solution: Add more patterns for TeX files and inspect
a few more files for being TeX files
(Wu, Zhenyu)
closes: vim/vim#1445661ee833a50
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
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#14487c97f4d61cd
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Vim9: heredoc start may be recognized in string.
Solution: Don't skip to closing bracket for invalid list assignment.
(zeertzjq)
closes: vim/vim#144721817ccdb10
Problem: Missing test for what patch v9.1.0285 fixes
Solution: Add a test for cursor movement at buffer boundaries.
(Luuk van Baal)
aa8e22b035
vim-patch:9.1.0225: test_matchparen not run in CI
Problem: test_matchparen not run in CI
Solution: add test_matchparen.res to NEW_TESTS_RES in Makefile,
update changed highlighting dump from v9.1.61
059aeac2be
Changes N/A and test result was restored in patch 9.1.0258 (included in #28160).
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#14294closes: vim/vim#144337a27c108e0
Co-authored-by: Christian Brabandt <cb@256bit.org>
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#14444closes: vim/vim#144469a91d2b72c
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
Problem: Wrong doc style for pandoc syntax description,
Test_diff_eob_halfpage() may fail depending on
screen size, using braces in highlight.c when
not necessary
Solution: Fix pandoc documentation, make sure the window
for the test has 7 lines, remove the braces.
a040019be6
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: R history files are not recognized
Solution: Detect '.Rhistory' files as r filetype
(Wu, Zhenyu)
closes: vim/vim#14440fc21b6437c
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
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
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
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
Problem: Autocommand may change currect directory after :tcd and :lcd.
Solution: Also clear tp_localdir and w_localdir when using aucmd_win.
(zeertzjq)
closes: vim/vim#144359d956ee8ea
Now that Nvim always supports nanotime, sleeping for some milliseconds
is actually enough, but for test_stat.vim keeping some longer sleeps may
increase test coverage, so just match the upstream test.
Problem: Test for TextChanged is still flaky with ASAN.
Solution: Don't index the result of readfile().
(zeertzjq)
It turns out that with ASAN the file may become empty during a write
even if it's non-empty both before and after the write, in which case
indexing the result of readfile() will error, so use join() instead.
Also don't delete the file halfway the test, just in case it may cause
errors on the next read.
closes: vim/vim#14421e9ff79a7c9
Problem: Two tests in test_filechanged.vim are slow.
Solution: Sleep for shorter if the +nanotime feature is available.
(zeertzjq)
closes: vim/vim#1441883cd2c7bf0
Problem: console dialog cannot save unnamed buffers
Solution: set bufname before save (glepnir). Define dialog_con_gui
to test for GUI+Console dialog support, use it to skip
the test when the GUI feature has been defined.
Note: The dialog_changed() function will also try to call the
browse_save_fname() function, when FEAT_BROWSE is defined (which is only
defined in a GUI build of Vim). This will eventually lead to a call of
do_browse(), which causes an error message if a GUI is not currently
running (see the TODO: in do_browse()) and will then lead to a failure
in Test_goto_buf_with_onfirm().
Therefore, we must disable the Test_goto_buf_with_onfirm(), when the
dialog_con_gui feature is enabled (which basically means dialog feature
for GUI and Console builds, in contrast to the dialog_con and dialog_gui
feature).
(Previously this wasn't a problem, because the test aborted in the YES
case for the :confirm :b XgotoConf case and did therefore not run into
the browse function call)
closes: vim/vim#14398df46115fc8
Co-authored-by: glepnir <glephunter@gmail.com>
Ref #21393
- Move default user commands to _defaults.lua as that now contains all
kinds of defaults rather than just default mappings and menus.
- Remove the :aunmenu as there are no menus when _defaults.lua is run.
Problem: Dialog for file changed outside of Vim not tested.
Solution: Add a test. Move FileChangedShell test. Add 'L' flag to
feedkeys().
5e66b42aae
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Normal mode TextChanged isn't tested properly.
Solution: Combine Test_Changed_ChangedI() and Test_Changed_ChangedI_2()
and also run it on Windows. Fix a typo in main.c.
(zeertzjq)
closes: vim/vim#14396c422662933
Problem: filetype: typespec files are not recognized
Solution: Detect '*.tsp' files as typespec
(Hilmar Wiegand)
Specs is at https://typespec.io/closes: vim/vim#143926c9f4f98f1
Co-authored-by: Hilmar Wiegand <me@hwgnd.de>
Problem: [security]: Heap buffer overflow when calling complete_add()
in the first call of 'completefunc'
Solution: Call check_cursor() after calling 'completefunc' (zeertzjq)
closes: vim/vim#143910a419e07a7
Problem: Filetype test fails.
Solution: Move detection by name before detection by extension.
Improve TextChanged test and remove wrong test and fix
a typo in a comment (zeertzjq).
closes: vim/vim#143738eb7523802
The changes to filetype.vim are N/A since Nvim always prefers filename
matches to extension matches.
Problem: Filetype detection fails if file name ends in many '~'.
Solution: Strip multiple '~' at the same time. (closesvim/vim#12553)
c12e4eecbb
In Nvim this already works as Lua filetype detection isn't subject to
such a small recursion limit as autocommands, but it still makes sense
to avoid unnecessary recursion.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: filetype: rock_manifest and config.ld files are not recognized
Solution: Detect 'rock_manifest' and 'config.ld' as lua
(Wu, Zhenyu)
closes: vim/vim#14370a917bd58bd
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Problem: filetype: fontconfig files are not recognized
Solution: detect 'fonts.conf' as xml
(Wu, Zhenyu)
closes: vim/vim#14367a2c27b01dc
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Problem: filetype: zsh theme, history and zunit files are not
recognized.
Solution: Detect '.zsh_history', '*.zsh-theme' and '*.zunit' as zsh
(Wu, Zhenyu)
closes: vim/vim#14366a55a22a1a3
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Problem: filetype: bash history files are not recognized
Solution: detect .bash-history and .bash_history files as bash
(Wu, Zhenyu)
closes: vim/vim#1436584ce55001a
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Problem: filetype: netrw history file is not recognized
Solution: Detect .netrwhist as vim files (Wu, Zhenyu)
closes: vim/vim#14364abbb4a4f70
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Problem: filetype: mysql history files are not recognized
Solution: Detect .mysql_history as mysql
(Wu, Zhenyu)
closes: vim/vim#143626b285c8cfd
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Problem: filetype: supertux files are not recognized
Solution: Supertux uses lisp to store hotkeys in config and game stage information,
so add a pattern for supertux files.
(Wu, Zhenyu)
Reference: https://github.com/SuperTux/supertux/wiki/S-Expressioncloses: vim/vim#143564ff83b904e
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Problem: filetype: support for Intel HEX files is lacking
Solution: Add more file extensions that are typical for Intel HEX files
(Wu, Zhenyu)
Reference: https://en.wikipedia.org/wiki/Intel_HEXcloses: vim/vim#14355e523dd9803
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Problem: Conceal test fails when rightleft feature is disabled.
Solution: Skip test if rightleft feature is missing (Julio B).
closes: vim/vim#143425df961a1bc
Co-authored-by: Julio B <julio.bacel@gmail.com>
Problem: Filetype may be undetected when a SwapExists autocommand sets
filetype in another buffer.
Solution: Make filetype detection state buffer-specific. Also fix a
similar problem for 'modified' (zeertzjq).
closes: vim/vim#143445bf6c2117f
Problem: TextChanged autocommand not triggered under some circumstances
(Sergey Vlasov)
Solution: Trigger TextChanged when TextChangedI has not been triggered
fixes: vim/vim#14332closes: vim/vim#143398603270293
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Recording may still be wrong in Select mode (after 8.2.3993).
Solution: Make sure a character isn't split between two buffer blocks.
(zeertzjq)
closes: vim/vim#14326ea95f1a5ad
Problem: Two unrelated things are tested by a single test.
Solution: Split it into two, restoring the old Test_brace_single_line().
Add missing cleanup to some tests.
(zeertzjq)
closes: vim/vim#14323ad493ef3ea
Problem: Page-wise scrolling with Ctrl-D/Ctrl-U implements
it's own logic to change the topline and cursor.
More logic than necessary for scrolling with Ctrl-F/Ctrl-B
was removed in patch 9.1.0211.
Solution: Re-use the logic from Ctrl-E/Ctrl-Y/Ctrl-F/Ctrl-B while
staying backward compatible as much as possible.
Restore some of the logic that determined how many lines will
be scrolled (Luuk van Baal)
5a2e3ec9ac
Problem: Unnecessary multiplications in backspace code, as
"col / ts * ts" is the same as "col - col % ts".
Solution: Change "col / ts * ts" to "col - col % ts". Adjust the loop
and the comments ins_bs() to be easier to understand. Update
tests to reset 'smarttab' properly.
(zeertzjq)
closes: vim/vim#143088ede7a0694
Problem: regexp: verymagic cannot match before/after a mark
Solution: Correctly check for the very magic check (Julio B)
Fix regexp parser for \v%>'m and \v%<'m
Currently \v%'m works fine, but it is unable to match before or after
the position of mark m.
closes: vim/vim#1430946fa3c7e27
Co-authored-by: Julio B <julio.bacel@gmail.com>
Problem: CI: MS-Windows fails in test_winfixbuf
(after v9.1.208)
Solution: Instead of skipping the test, write the file
so it exists on disk, to verify that MS-Windows
short filename expansion is successful.
(Sean Dewar)
related: vim/vim#14286aed6554b46
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Problem: Error on exit with EXITFREE and 'winfixbuf'.
Solution: Handle DT_FREE before checking for 'winfixbuf'.
(zeertzjq)
closes: vim/vim#14314620e85265c
Problem: Page-wise scrolling with Ctrl-F/Ctrl-B implements
it's own logic to change the topline and cursor.
In doing so, skipcol is not handled properly for
'smoothscroll', and virtual lines.
Solution: Re-use the logic from Ctrl-E/Ctrl-Y while staying
backward compatible as much as possible.
b9f5b95b7b
Problem: filetype: support for gnuplot files is lacking
Solution: Also detect *.gnuplot files
(RobbiZ98)
closes: vim/vim#142433a6bd0c5c7
Co-authored-by: RobbiZ98 <113035863+RobbiZ98@users.noreply.github.com>
Problem: winfixbuf does not allow to re-edit current buffer
(Tim Pope, after v9.1.0147)
Solution: Explicitly allow :e even when 'winfixbuf' is set,
since it just re-loads the current buffer
(Colin Kennedy)
fixes: vim/vim#14237closes: vim/vim#1428665e580bd56
Problem: Backspace inserts spaces with virtual text and 'smarttab'.
Solution: Ignore virtual text and wrapping when backspacing.
(zeertzjq)
related: neovim/neovim#28005closes: vim/vim#142960185c77014
Co-authored-by: VanaIgr <vanaigranov@gmail.com>
Problem: Cannot use modifiers before :-Ntabmove.
Solution: Check backwards from the command instead of checking from the
start of the command line. Slightly adjust docs to make them
more consistent (zeertzjq).
closes: vim/vim#14289076faac537
Problem: Not enough tests for the slice() function.
Solution: Test with multibyte chars, and in both Legacy and Vim9 script.
Update docs to be clearer about how it treats composing chars.
(zeertzjq)
closes: vim/vim#14275ad38769030
Problem: :drop tries to :rewind the argumentlist, which results in E37
(after v9.1.0046)
Solution: instead of calling ex_rewind(), call open_buffer() only when
re-using the initial empty buffer
fixes: vim/vim#14219closes: vim/vim#14220978178823b
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: complete_info() returns wrong order of items
(after v9.0.2018)
Solution: Revert Patch v9.0.2018
(Girish Palya)
bug fix: complete_info() gives wrong results
1) complete_info() reverses list of items during <c-p>
2) 'selected' item index is wrong during <c-p>
3) number of items returnd can be wrong
Solution:
- Decouple 'cp_number' from 'selected' index since they need not be
correlated
- Do not iterate the list backwards
- Add targeted tests
Regression introduced by 69fb5afb3b
Following are unnecessary commits to patch problems from above:
fef6630166daef8c7437
All the tests from above commits are retained though.
fixes: vim/vim#14204closes: vim/vim#142418950bf7f8b
Remove EMPTY_IF_NULL() as it has been unnecessary since #12673.
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: Vento files are not recognized.
Solution: Recognize *.vto files as filetype "vento" (wrapperup)
Vento is a templating engine https://vento.js.org/closes: vim/vim#142299f26e5a9bc
Co-authored-by: wrapperup <wrapperup4@gmail.com>
Problem: Not all standard treesitter groups are documented.
Solution: Document them all (without relying on fallback); add default
link for new `*.builtin` groups to `Special` and `@keyword.type` to
`Structure`. Remove `@markup.environment.*` which only made sense for
LaTeX.
Problem: Wrong cursor position when clicking after end of line with
'rightleft', 'virtualedit' and conceal.
Solution: Set values in ScreenCols[] also with SLF_RIGHTLEFT. Also fix
off-by-one cursor position with 'colorcolumn' (zeertzjq).
closes: vim/vim#14218deb2204bff
Problem: Cursor position wrong when clicking with conceal and wrap.
Solution: Use the virtual column of the last char for ScreenCols[] in
boguscols. Remove use of MAXCOL in ScreenCols[]. Rename
third argument of wlv_screen_line() to "clear_end" as that's
clearer what it does (zeertzjq).
related: 14192
closes: vim/vim#14200d0c1b7723f
Rename win_put_linebuf() to wlv_put_linebuf().
Problem: Can define function with invalid name inside 'formatexpr'.
Solution: Use goto instead of checking for did_emsg later.
(zeertzjq)
closes: vim/vim#142096a04bf5ee5
Problem: Wrong display or screenpos() result when toggling diff mode.
Solution: Reset w_skipcol when disabling 'wrap'. Reset w_leftcol when
enabling 'wrap' (zeertzjq).
fixes: vim/vim#14210closes: vim/vim#142119e7f1fc2f1
Problem: no overflow check for string formatting
Solution: Check message formatting function for overflow.
(Chris van Willegen)
closes: vim/vim#13799c35fc03dbd
Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
Problem: Cursor pos wrong when double-width chars are concealed.
Solution: Advance one more virtual column for a double-width char.
Run some tests with both 'wrap' and 'nowrap' (zeertzjq).
closes: vim/vim#14197010e1539d6
Problem: Coverity reports dead code.
Solution: Remove the dead code. Also fix a mistake in ml_get_pos_len()
and update some comments (zeertzjq).
closes: vim/vim#141898c55d60658
Problem: Cursor column wrong with 'virtualedit' and conceal.
Solution: Correct cursor column at end of line if never reached.
(zeertzjq)
closes: vim/vim#14190253ff4dece
Problem: 'cursorline' and 'wincolor' highlight missing with concealed and
wrapped lines.
Solution: Apply 'cursorline' and 'wincolor' highlight to boguscols.
(zeertzjq)
Since 'cursorline' and 'wincolor' highlight apply after the end of the
line, it is more consistent to have them also apply to boguscols.
Assigning MAXCOL to values in ScreenCols[] make mouse click behave the
same with 'cursorline' and 'nocursorline', but such behavior may be
incorrect, as it puts the cursor on the next screen line. That may be
fixed in a future PR.
closes: vim/vim#1419221b0a3df8c
Problem: E1513 might be confusing
(Christoph Thoma)
Solution: reword error message, fix test to not
depend on the actual message
fixes: vim/vim#141890a32b8854b
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: winframe functions incorrectly recompute window positions if
the altframe wasn't adjacent to the closed frame, which is
possible if adjacent windows had 'winfix{width,height}' set.
Solution: recompute for windows within the parent of the altframe and
closed frame. Skip this (as before) if the altframe was
top/left, but only if adjacent to the closed frame, as
positions won't change in that case. Also correct the return
value documentation for win_screenpos. (Sean Dewar)
The issue revealed itself after removing the win_comp_pos call below
winframe_restore in win_splitmove. Similarly, wrong positions could result from
windows closed in other tabpages, as win_free_mem uses winframe_remove (at least
until it is entered later, where enter_tabpage calls win_comp_pos).
NOTE: As win_comp_pos handles only curtab, it's possible via other means for
positions in non-current tabpages to be wrong (e.g: after changing 'laststatus',
'showtabline', etc.). Given enter_tabpage recomputes it, maybe it's intentional
as an optimization? Should probably be documented in win_screenpos then, but I
won't address that here.
closes: vim/vim#14191
Nvim: don't reuse "wp" for "topleft" in winframe_remove, so the change
integrates better with the call to winframe_find_altwin before it.
5866bc3a0f
Problem: small improvements can be made to split-move related
functions.
Solution: apply them (Sean Dewar):
Some of these changes were already applied to Nvim.
Here are the ones which were missing:
- Improve some doc comments (frame_flatten should still work for non-current
tabpages, despite the topframe check, which looks benign, though I'm unsure if
it's still needed; see vim/vim#2467).
- f_win_splitmove should check_split_disallowed on wp, not targetwin, as that's
what win_splitmove checks (though it's probably unnecessary to check
b_locked_split at all; see vim/vim#14109, which I hope to get around to
finishing at some point).
- Apply the winframe_restore comment changes, and remove win_comp_pos from after
winframe_restore in win_splitmove, as it shouldn't be necessary (no need to
remove it from nvim_win_set_config too, as it was already omitted).
Move win_append after winframe_restore in win_splitmove to match Vim.
closes: vim/vim#141855cac1a9bee
Problem: more places exist where curwin == prevwin, and it may even be
expected in some cases.
Solution: revert v9.1.0001, but document that it's possible instead.
(Sean Dewar)
I've had a change of heart for the following reasons:
- A quick 'n dirty [GitHub code search](https://github.com/search?q=%2F%28winnr%5C%28%5C%29%5Cs*%3D%3D%5Cs*winnr%5C%28%5B%27%22%5D%23%5B%27%22%5D%5C%29%7Cwinnr%5C%28%5B%27%22%5D%23%5B%27%22%5D%5C%29%5Cs*%3D%3D%5Cs*winnr%5C%28%5C%29%29%2F&type=code)
reveals some cases where it's expected in the wild.
Particularly, it made me aware `winnr() == winnr('#')` is possible when curwin
is changed temporarily during the evaluation of a &statusline expression item
(`%{...}`), and is used to show something different on the statusline
belonging to the previous window; that behaviour wasn't changed in v9.1.0001,
but it means curwin == prevwin makes sense in some cases.
- The definition and call sites of back_to_prevwin imply some expectation that
prevwin == wp (== curwin) is possible, as it's used to skip entering the
prevwin in that case.
- Prior to v9.1.0001, `:wincmd p` would not beep in the case that was patched in
v9.1.0001, but now does. That resulted in vim/vim#14047 being opened, as it affected
the CtrlP plugin.
I find it odd that `:wincmd p` had cases where it wouldn't beep despite doing
nothing, but it may be preferable to keep things that way (or instead also
beep if curwin == prevwin, if that's preferred).
- After more digging, I found cases in win_free_mem, enter_tabpage,
aucmd_restbuf and qf_open_new_cwindow where curwin == prevwin is possible
(many of them from autocommands). Others probably exist too, especially in
places where curwin is changed temporarily.
fixes: vim/vim#14047closes: vim/vim#14186d64801e913
Problem: current window number returned by tabpagewinnr may be outdated
when called from win_execute for the original tabpage.
Solution: update the original tabpage's tp_curwin in switch_win; use
{un}use_tabpage instead. Don't do it in restore_win to ensure
tp_curwin of the temporarily visited tabpage is unchanged from
switch_win visiting it, as before. (Sean Dewar)
Maybe restore_win should only restore tp_curwin if
`curtab == switchwin->sw_curtab`, in case the user changed tabpages from within
win_execute, but not doing that is consistent with the old behaviour.
related: vim/vim#14186e101028a5c
Problem: Changing buffer in another window using win_execute() causes
it to show matchparen (after 9.0.0969).
Solution: Delay highlighting with SafeState in BufWinEnter.
(zeertzjq)
closes: vim/vim#1417749ffb6b428
Problem: Internal error with blockwise getregion() in another buffer
Solution: Also change curwin->w_buffer when changing curbuf (zeertzjq)
closes: vim/vim#141795406eb8722
Problem: may not be clear why failing to split causes an ":Xdo" command
to abort if 'wfb' is set.
Solution: do not return immediately if win_split fails, so E1513 is
still given. Expect both errors in the test. Also fix tests to
pass CI.
(Sean Dewar)
closes: vim/vim#14152769eb2d0c3
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Problem: Coverity complains about ignoring return value of win_split()
(after v9.1.150)
Solution: Check if win_split() failed, add winfixbuf.res to Makefile
af7ae81600
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: several minor 'winfixbuf' issues exist, mostly relating to the
quickfix list
Solution: address them and adjust tests. Retab and reflow a few things too.
(Sean Dewar)
Things touched include:
- Replace the semsgs with gettext'd emsgs.
- Handle window switching in ex_listdo properly, so curbuf and curwin
are kept in-sync and trigger autocommands; handle those properly.
- Don't change the list entry index in qf_jump_edit_buffer if we fail
due to 'wfb' (achieved by returning FAIL; QF_ABORT should only be used
if the list was changed).
- Make qf_jump_edit_buffer actually switch to prevwin when using `:cXX`
commands **outside** of the list window if 'wfb' is set in curwin.
Handle autocommands properly in case they mess with the list.
NOTE: previously, it seemed to split if 'wfb' was set, but do nothing
and fail if prevwin is *valid*. This behaviour seemed strange, and maybe
unintentional? Now it aligns more with what's described for the `:cXX`
commands in the original PR description when used outside a list window,
I think.
- In both functions, only consider prevwin if 'wfb' isn't set for it;
fallback to splitting otherwise.
- Use win_split to split. Not sure if there was a specific reason for
using ex_splitview. win_split is simpler and respects modifiers like
:vertical that may have been used. Plus, its return value can be checked
for setting opened_window in qf code (technically win_split_ins autocmds
could immediately close it or change windows, in which the qf code might
close some other window on failure; it's already the case elsewhere,
though).
closes: vim/vim#141424bb505e28c
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Problem: qf_goto_win_with_qfl_file may check if prevwin has 'winfixbuf'
set without checking if it's valid first.
Solution: Reverse the condition. Add a test, a modeline, and a missing
CheckFeature. (Searn Dewar)
closes: vim/vim#141405131f224da
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Problem: Internal error or crash when passing invalid position to
getregion().
Solution: Give an error for invalid position (zeertzjq).
closes: vim/vim#1417226dd09ad5e
Problem: too many STRLEN calls when getting a memline
Solution: Optimize calls to STRLEN(), add a few functions in memline.c
that return the byte length instead of relying on STRLEN()
(John Marriott)
closes: vim/vim#1405202d7a6c6cf
Cherry-pick line break changes from patch 8.1.0226.
Cherry-pick ml_line_len from patch 8.1.0579.
Cherry-pick test_comments.vim change from patch 9.1.0153.
Co-authored-by: John Marriott <basilisk@internode.on.net>
Problem: Crash in WinClosed after BufUnload closes other windows
Solution: Don't trigger WinClosed if the buffer is NULL (zeertzjq)
Now win_close_othertab() doesn't trigger any autocommands if the buffer
is NULL, so remove the autocmd blocking above (which was added not long
ago in patch v9.0.0550) for consistency.
Also remove an unreachable close_last_window_tabpage() above:
- It is only reached if only_one_window() returns TRUE and last_window()
returns FALSE.
- If only_one_window() returns TRUE, there is only one tabpage.
- If there is only one tabpage and last_window() returns FALSE, the
one_window() in last_window() must return FALSE, and the ONE_WINDOW
in close_last_window_tabpage() must also be FALSE.
- So close_last_window_tabpage() doesn't do anything and returns FALSE.
Then the curtab != prev_curtab check also doesn't make much sense, and
the only_one_window() can be replaced with a check for popup and a call
to last_window() since this is a stricter check than only_one_window().
closes: vim/vim#14166b2ec0da080
Problem: expand() removes a slash after an environment variable that
ends with a colon on Windows.
Solution: Check the correct char for a colon (zeertzjq)
closes: vim/vim#14161
Note: Vim still removes the path-separator at the end, if another path separator
follows directly after it, e.g. on:
```
echo $FOO='/usr/'
echo expand('$FOO/bar') == '/usr/bar'
```
see:
,----[ misc1.c:1630 ]
| // if var[] ends in a path separator and tail[] starts
| // with it, skip a character
| if (after_pathsep(dst, dst + c)
| #if defined(BACKSLASH_IN_FILENAME) || defined(AMIGA)
| && (dst == save_dst || dst[-1] != ':')
| #endif
| && vim_ispathsep(*tail))
| ++tail;
`----
13a014452a
Cherry-pick test_expand.vim change from patch 9.0.1257.
Problem: Crash on exit with EXITFREE and using win_execute().
Solution: Also save and restore tp_topframe. (issue vim/vim#9374)
dab17a0689
Couldn't repro the crash in the test, but I only care about this patch so
switch_win sets topframe properly for win_split_ins in nvim_open_win and
nvim_win_set_config.
Add a test using nvim_win_call and :wincmd, as I couldn't repro the issue via
nvim_open_win or nvim_win_set_config (though it's clear they're affected by this
patch).
That said, at that point, could just use {un}use_tabpage inside switch_win
instead, which also updates tp_curwin (though maybe continue to not set it in
restore_win). That would also fix possible inconsistent behaviour such as:
:call win_execute(w, "let curwin_nr1 = tabpagewinnr(1)")
:let curwin_nr2 = tabpagewinnr(1)
Where it's possible for curwin_nr1 != curwin_nr2 if these commands are run from
the 1st tabpage, but window "w" is in the 2nd (as the 1st tabpage's tp_curwin
may still be invalid). I'll probably PR a fix for that later in Vim.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: illegal memory access when completing with invalid bytes.
Solution: Avoid going over the end of the completion text.
vim/vim@4b28ba3
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Its corresponding test in Vim is in test_popupwin.win, so having it in
the middle of test_window_cmd.vim is strange, and it is now covered by
tests in ui/float_spec.lua anyway.
Problem: heap-use-after-free in win_splitmove if Enter/Leave
autocommands from win_split_ins immediately closes "wp".
Solution: check that "wp" is valid after win_split_ins.
(Sean Dewar)
abf7030a5c
Problem: win_gotoid() checks for textlock and other things when switching
to a window that is already current (after v9.1.0119)
Solution: return early with success when attempting to switch to curwin
(Sean Dewar)
2a65e73944
Problem: infinite loop in win_update with 'smoothscroll' set when
window width is equal to textoff, or signed integer overflow
if smaller.
Solution: don't revalidate wp->w_skipcol in that case, as no buffer text
is being shown. (Sean Dewar)
02fcae02a9
Test_window_split_no_room changes were already cherry-picked earlier.
Problem: can switch windows while textlocked via f_win_gotoid and
f_win_splitmove (which also allows switching in the cmdwin).
Solution: Check text_or_buf_locked in f_win_splitmove()
(Sean Dewar)
While at it, call text_or_buf_locked() in f_win_gotoid() instead of testing for
cmdwin_type() (which text_buf_locked() does and in addition will also verify
that the buffer is not locked).
f865895c87
Problem: win_splitmove fires WinNewPre and possibly WinNew when moving
windows, even though no new windows are created.
Solution: don't fire WinNew and WinNewPre when inserting an existing
window, even if it isn't the current window. Improve the
accuracy of related documentation. (Sean Dewar)
96cc4aef3d
Partial as WinNewPre has not been ported yet (it currently has problems anyway).
Problem: win_split_ins has no check for E36 when moving an existing
window
Solution: check for room and fix the issues in f_win_splitmove()
(Sean Dewar)
0fd44a5ad8
Omit WSP_FORCE_ROOM, as it's not needed for Nvim's autocmd window, which is
floating. Shouldn't be difficult to port later if it's used for anything else.
Make win_splitmove continue working for turning floating windows into splits.
Move the logic for "unfloating" a float to win_split_ins; unlike splits, no
changes to the window layout are needed before calling it, as floats take no
room in the window layout and cannot affect the e_noroom check.
Add missing tp_curwin-fixing logic for turning external windows into splits, and
add a test.
NOTE: there are other issues with the way "tabpage independence" is implemented
for external windows; namely, some things assume that tp_curwin is indeed a
window within that tabpage, and as such, functions like tabpage_winnr and
nvim_tabpage_get_win currently don't always work for external windows (with the
latter aborting!)
Use last_status over frame_add_statusline, as Nvim's last_status already does
this for all windows in the current tabpage. Adjust restore_full_snapshot_rec to
handle this.
This "restore everything" approach is changed in a future commit anyway, so only
ensure it's robust enough to just pass tests.
Keep check_split_disallowed's current doc comment, as it's actually a bit more
accurate here. (I should probably PR Vim to use this one)
Allow f_win_splitmove to move a floating "wp" into a split; Nvim supports this.
Continue to disallow it from moving the autocommand window into a split (funnily
enough, the check wasn't reachable before, as moving a float was disallowed),
but now return -1 in that case (win_splitmove also returns FAIL for this, but
handling it in f_win_splitmove avoids us needing to switch windows first).
Cherry-pick Test_window_split_no_room fix from v9.1.0121.
Update nvim_win_set_config to handle win_split_ins failure in later commits.
Problem: 'shortmess' "F" flag doesn't work properly with 'autoread'
(after 9.1.0154)
Solution: Hide the file info message instead of the warning dialog
(zeertzjq)
closes: vim/vim#14159closes: vim/vim#141588a01744c56
Problem: Duplicate assignment in f_getregion().
Solution: Remove the duplicate assignment. Also improve getregion()
docs wording and fix an unrelated typo (zeertzjq)
closes: vim/vim#141540df8f93bda
Problem: can only call getregion() for current buffer
Solution: Allow to retrieve selections from different buffers
(Shougo Matsushita)
closes: vim/vim#1413184bf6e658d
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Problem: v:echospace wrong after setting invalid value to 'showcmdloc'.
Solution: Only call comp_col() if value is valid.
(zeertzjq)
closes: vim/vim#14119c27fcf4857
Problem: the amount of available space (v:echospace) on the command
line is not correct when showcmdloc is drawn into the
statusline or tabline.
Solution: only add SHOWCMD_COLS to the shown command column when
'showcmdloc' is set to last (Sam-programs)
closes: vim/vim#14108062141b1a7
Co-authored-by: Sam-programs <130783534+Sam-programs@users.noreply.github.com>
Problem: getregion() needs more tests
Solution: Run the getregion() test in both the legacy and Vim9 contexts
(Yegappan Lakshmanan)
closes: vim/vim#141144d55c54e30
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: [security]: autocmd cause use-after-free in set_curbuf()
(kawarimidoll)
Solution: check side-effect of BufLeave autocommand, when the number
of windows changed, close windows containing buffers that will
be wiped, if curbuf changed unexpectedly make sure b_nwindows
is decremented otherwise it cannot be wiped
set_curbuf() already makes some efforts to ensure the BufLeave
autocommands do not cause issues. However there are still 2 issues
that are not taken care of:
1) If a BufLeave autocommand opens a new window containing the same
buffer as that is going got be closed in close_buffer() a bit later,
we suddenly have another window open, containing a free'd buffer. So we
must check if the number of windows changed and if it does (and the
current buffer is going to be wiped (according to the 'bufhidden'
setting), let's immediately close all windows containing the current
buffer using close_windows()
2) If a BufLeave autocommand changes our current buffer (displays it in
the current window), buf->b_nwindow will be incremented. As part of
set_curbuf() we will however enter another buffer soon, which means, the
newly created curbuf will have b_nwindows still have set, even so the
buffer is no longer displayed in a window. This causes later problems,
because it will no longer be possible to wipe such a buffer. So just
before entering the final buffer, check if the curbuf changed when
calling the BufLeave autocommand and if it does (and curbuf is still
valid), decrement curbuf->b_nwindows.
Both issues can be verified using the provided test (however the second
issue only because such an impacted buffer won't be wiped, causing
futher issues in later tests).
fixes: vim/vim#13839closes: vim/vim#1410455f8bba73b
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: getregion() can be improved (after v9.1.120)
Solution: change getregion() implementation to use pos as lists and
one optional {opt} dictionary (Shougo Matsushita)
Note: The following is a breaking change!
Currently, the getregion() function (included as of patch v9.1.120) takes
3 arguments: the first 2 arguments are strings, describing a position,
arg3 is the type string.
However, that is slightly inflexible, there is no way to specify
additional arguments. So let's instead change the function signature to:
getregion(pos1, pos2 [, {Dict}]) where both pos1 and pos2 are lists.
This is slightly cleaner, and gives us the flexibility to specify
additional arguments as key/value pairs to the optional Dict arg.
Now it supports the "type" key to specify the selection type
(characterwise, blockwise or linewise) and now in addition one can also
define the selection type, independently of what the 'selection' option
actually is.
Technically, this is a breaking change, but since the getregion()
Vimscript function is still quite new, this should be fine.
closes: vim/vim#1409019b718828d
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Problem: Put in Visual mode wrong if it replaces fold marker.
Solution: Temporarily disable folding during put in Visual mode.
(zeertzjq)
fixes: vim/vim#14097closes: vim/vim#141004e141c66b9
Problem: Insufficient testing for 'delcombine'.
Solution: Add test for both Normal and Insert modes without Arabic.
(zeertzjq)
closes: vim/vim#14086cd3a13e774
Problem: buffer-completion code too complicated and does not always
find all matches (irisjae)
Solution: do not try to anchor pattern to beginning of line or
directory-separator, always return all matches
Note: we are considering the non-fuzzy buffer-matching here.
Currently, the buffer-completion code makes 2 attempts to match a
pattern against the list of available patterns. First try is to match
the pattern and anchor it to either the beginning of the file name or
at a directory-separator (// or \\).
When a match is found, Vim returns the matching buffers and does not try
to find a match anywhere within a buffer name. So if you have opened two
buffers like /tmp/Foobar.c and /tmp/MyFoobar.c using `:b Foo` will only
complete to the first filename, but not the second (the same happens
with `getcompletion('Foo', 'buffer')`).
It may make sense, that completion priorities buffer names at directory
boundaries, but it inconsistent, may cause confusion why a certain
buffer name is not completed when typing `:b Foo<C-D>` which returns
only a single file name and then pressing Enter (to switch to that
buffer), Vim will error with 'E93: More than one match for Foo').
Similar things may happen when wiping the /tmp/Foobar.c pattern and
afterwards the completion starts completing other buffers.
So let's simplify the code and always match the pattern anywhere in the
buffer name, do not try to favor matches at directory boundaries. This
is also simplifies the code a bit, we do not need to run over the list
of buffers several times, but only twice.
fixesvim/vim#13894closes: vim/vim#140820dc0bff000
Cherry-pick test_cmdline.vim from patch 9.1.0019 as it already passes.
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: using "C" and 've=all' set, doesn't include composing chars
when changing a line, keeps the composing chars for whatever
is typed afterwards.
Solution: Use mb_head_off() and mb_ptr2len() instead of mb_tail_off().
(zeertzjq)
closes: vim/vim#14083048761bcd4
Problem: Internal error when passing mark in another buffer to
getregion().
Solution: Don't allow marks in another buffer (zeertzjq)
closes: vim/vim#14076
Internal error when passing mark in another buffer to getregion()
421b597470
Problem: hard to get visual region using Vim script
Solution: Add getregion() Vim script function
(Shougo Matsushita, Jakub Łuczyński)
closes: vim/vim#13998closes: vim/vim#115793f905ab3c4
Cherry-pick changes from patch 9.1.0122, with :echom instead of :echow.
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl>
runtime(filetype): Modula-2 files with priority not detected (vim/vim#14055)
Problem: Modula-2 files with a specified priority are not detected.
Solution: Match the priority syntax in module header lines when
performing heuristic content detection.
Disable the :defcompile debug line. This was accidentally left enabled
in commit 68a8947.
ef387c062b
Co-authored-by: dkearns <dougkearns@gmail.com>
Problem: Using freed memory with full tag stack and user data
(Konstantin Khlebnikov)
Solution: Clear the user data pointer of the newest entry.
(zeertzjq, Konstantin Khlebnikov)
fixes: neovim/neovim#27498closes: vim/vim#14053c86bff1771
Cherry-pick Test_tag_stack() changes from patch 9.0.0767.
Co-authored-by: Konstantin Khlebnikov <koct9i@gmail.com>
Problem: Setting some options changes curswant unnecessarily.
Solution: Add a P_HLONLY flag that prevents changing curswant.
(zeertzjq)
closes: vim/vim#14044fcaed6a70f
Problem: When the quickfix buffer has been modified an autocommand
may invalidate the undo stack (kawarimidoll)
Solution: When clearing the quickfix buffer, also wipe the undo stack
fixes: vim/vim#13905closes: vim/vim#13928f0d3d4a426
Co-authored-by: Christian Brabandt <cb@256bit.org>
The '*.bats' file type is for Bash Automated Testing System (BATS)
scripts. BATS scripts are Bash with a special '@test' extension but they
otherwise work with Vim's bash filetype.
See https://github.com/bats-core/bats-corecloses: vim/vim#14039d00fb4b3a2
Co-authored-by: Brandon Maier <brandon.maier@collins.com>
The 'Config.in' file type is for Buildroot configuration files.
Buildroot Config.in files use the same Kconfig backend as the Linux
kernel's Kconfig files.
Buildroot also has other filename variants that follow "Config.in.*",
they are used to distinguish multiple Config.in files in the same
directory.
See https://buildroot.org/downloads/manual/manual.html#_literal_config_in_literal_filecloses: vim/vim#140385f20f050ef
Co-authored-by: Brandon Maier <brandon.maier@collins.com>
Problem: filetype: no support for dtso files
Solution: Add detection for *.dtso files as dts file type
(Markus Schneider-Pargmann)
*.dtso files are devicetree overlay files which have the same syntax as dts or dtsi files.
closes: vim/vim#14026b1700fb33f
Co-authored-by: Markus Schneider-Pargmann <msp@baylibre.com>
Problem: upper-case of ß should be U+1E9E (CAPITAL LETTER SHARP S)
(fenuks)
Solution: Make gU, ~ and g~ convert the U+00DF LATIN SMALL LETTER SHARP S (ß)
to U+1E9E LATIN CAPITAL LETTER SHARP S (ẞ), update tests
(glepnir)
This is part of Unicode 5.1.0 from April 2008, so should be fairly safe
to use now and since 2017 is part of the German standard orthography,
according to Wikipedia:
https://en.wikipedia.org/wiki/Capital_%E1%BA%9E#cite_note-auto-12
There is however one exception: UnicodeData.txt for U+00DF
LATIN SMALL LETTER SHARP S does NOT define U+1E9E LATIN CAPITAL LETTER
SHARP S as its upper case version. Therefore, toupper() won't be able
to convert from lower sharp s to upper case sharp s (the other way
around however works, since U+00DF is considered the lower case
character of U+1E9E and therefore tolower() works correctly for the
upper case version).
fixes: vim/vim#5573closes: vim/vim#14018bd1232a1fa
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: 'breakindentopt' "min" works incorrectly with 'signcolumn'.
Solution: Use win_col_off() and win_col_off2().
(zeertzjq)
closes: vim/vim#14014f0a9d65e0a
Problem: CompleteChanged not triggered when new leader added causing
no matching item in the completion menu
Solution: When completion is active but no items matched still trigger
CompleteChanged event
(glepnir)
closes: vim/vim#139820d3c0a66a3Fix#15077
Problem: 'breakindent' behaves inconsistently with 'list' and splits.
Solution: Use 'listchars' from the correct window and handle caching
properly. Move cheaper comparisons to the top.
(zeertzjq)
closes: vim/vim#14008efabd7c8d4
When "q" is set in 'shortmess' it now fully hides the "recording @a" message
when you are recording a macro instead of just shortening to "recording". This
removes duplication when using reg_recording() in the statusline.
Related #19193
Problem: Restore lastused_tabpage too early in do_arg_all() function it
will change later in the function.
Solution: Restore lastused_tabpage a bit later, when being done with
tabpages (glepnir)
closes: vim/vim#139922975a54f28
Problem: TextChanged not triggered for :norm! commands
(machakann, after v9.0.2031)
Solution: Only reset curbuf->b_last_changedtick if TextChangedI
was triggered in insert mode (and not blocked)
Note: for unknown reasons, the test fails on Windows (but seems to work
fine when running interactively)
fixes: vim/vim#13967closes: vim/vim#13984c9e79e5284
Cherry-pick test_autocmd.vim change from patch 8.2.4149.
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Visual hl wrong when it ends before multibyte 'showbreak'.
(lacygoil)
Solution: Use vcol_sbr instead of adding n_extra.
(zeertzjq)
fixes: vim/vim#11272closes: vim/vim#13996df23d7f4bd
Bug doesn't apply to Nvim.
Problem: Redrawing can be improved when inserting/deleting lines with 'number'.
Solution: Only redraw the number column of lines below changed lines.
Add a test as this wasn't previously tested.
(zeertzjq)
closes: vim/vim#13985ae07ebc04b
Problem: Redrawing can be improved when deleting lines with 'cursorline'.
Solution: Use smarter invalidation and adjustment. Remove unnecessary
UPD_VALID as it is already set at the top of the loop. Make
the test for vim/vim#4862 fail without the fix.
(zeertzjq)
closes: vim/vim#139867ce34c9a94
Problem: LineNrAbove and LineNrBelow background wrong on wrapped lines.
Solution: Update number column also for wrapped part of a line.
(zeertzjq)
closes: vim/vim#13974ebfd856cfd
Cherry-pick test_number.vim changes from patch 9.0.0626.
Problem: insert completion not correct when adding new leader
Solution: Reset compl_curr_match to compl_shown_match
(glepnir)
closes: vim/vim#13957cbb46b4398
- Consistently use the variable CMAKE_BUILD_TYPE to select build type.
- Remove broken `doc_html` target.
- Remove swap files created by oldtest when cleaning.
- Only rerun `lintdoc` if any documentation files has changed.
Problem: Crash when using gettabwinvar() with invalid arguments. (Yilin
Yang)
Solution: Use "curtab" if "tp" is NULL. (closesvim/vim#5475)
ee93b737aa
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Segfault with CompleteChanged autocommand
(markonm )
Solution: Test match->cp_prev for being NULL before accessing it
closes: vim/vim#13929fef6630166
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Recorded register cannot be translated using keytrans() when
it involves character search (iddqd505)
Solution: Record a K_IGNORE instead of a K_NOP (zeertzjq)
related: vim/vim#13916closes: vim/vim#13925bf321806bf
Problem: E95 is possible if a buffer called "[Command Line]" already
exists when opening the cmdwin. This can also happen if the
cmdwin's buffer could not be deleted when closing.
Solution: Un-name the cmdwin buffer, and give it a special name instead,
similar to what's done for quickfix buffers and for unnamed
prompt and scratch buffers. As a result, BufFilePre/Post are
no longer fired when opening the cmdwin. Add a "command" key
to the dictionary returned by getbufinfo() to differentiate
the cmdwin buffer instead. (Sean Dewar)
Cherry-pick test_normal changes from v9.0.0954.
1fb4103206
Problem: Autocmds triggered from opening the cmdwin (in win_split and
do_ecmd) can cause issues such as E199, as the current checks
are insufficient.
Solution: Commands executed from the cmdwin apply to the old curwin/buf,
so they should be kept in a "suspended" state; abort if
they've changed. Also abort if cmdwin/buf was tampered with,
and check that curwin is correct. Try to clean up the cmdwin
buffer (only if hidden and non-current to simplify things; the
same approach is used when closing cmdwin normally), and add a
beep. (Sean Dewar)
Rename the old Test_cmdwin_interrupted() like in the patch (can be moved to
test_cmdwin.vim when v9.0.0027 is ported).
Move the error message to `e_active_window_or_buffer_changed_or_deleted`.
43b395ec2e
Problem: Things that temporarily change/restore curwin/buf (e.g:
win_execute, some autocmds) may break assumptions that
curwin/buf is the cmdwin when "cmdwin_type != 0", causing
issues.
Solution: Expose the cmdwin's real win/buf and check that instead. Also
try to ensure these variables are NULL if "cmdwin_type == 0",
allowing them to be used directly in most cases without
checking cmdwin_type. (Sean Dewar)
Reset and save `cmdwin_old_curwin` in a similar fashion.
Apply suitable changes for API functions and add Lua tests.
988f74311c
Problem: Cannot map Super Keys in GTK UI
(Casey Tucker)
Solution: Enable Super Key mappings in GTK using <D-Key>
(Casey Tucker)
As a developer who works in both Mac and Linux using the same keyboard,
it can be frustrating having to remember different key combinations or
having to rely on system utilities to remap keys.
This change allows `<D-z>` `<D-x>` `<D-c>` `<D-v>` etc. to be recognized
by the `map` commands, along with the `<D-S-...>` shifted variants.
```vimrc
if has('gui_gtk')
nnoremap <D-z> u
nnoremap <D-S-Z> <C-r>
vnoremap <D-x> "+d
vnoremap <D-c> "+y
cnoremap <D-v> <C-R>+
inoremap <D-v> <C-o>"+gP
nnoremap <D-v> "+P
vnoremap <D-v> "-d"+P
nnoremap <D-s> :w<CR>
inoremap <D-s> <C-o>:w<CR>
nnoremap <D-w> :q<CR>
nnoremap <D-q> :qa<CR>
nnoremap <D-t> :tabe<CR>
nnoremap <D-S-T> :vs#<CR><C-w>T
nnoremap <D-a> ggVG
vnoremap <D-a> <ESC>ggVG
inoremap <D-a> <ESC>ggVG
nnoremap <D-f> /
nnoremap <D-g> n
nnoremap <D-S-G> N
vnoremap <D-x> "+x
endif
```
closes: vim/vim#1269892e90a1e10
Co-authored-by: Casey Tucker <dctucker@hotmail.com>
Problem: Incorrect number of trailing spaces inserted for multibyte
characters when pasting a blockwise register in blockwise visual
mode (VanaIgr)
Solution: Skip over trailing UTF-8 bytes when computing the number of trailing
spaces (VanaIgr)
When pasting in blockwise visual mode, and the register type is <CTRL-V>, Vim
aligns the text after the replaced area by inserting spaces after pasted
lines that are shorter than the longest line. When a shorter line contains
multibyte characters, each trailing UTF-8 byte's width is counted in addition
to the width of the character itself. Each trailing byte counts as being 4
cells wide (since it would be displayed as <xx>).
closes: vim/vim#139096638ec8afa
Co-authored-by: VanaIgr <vanaigranov@gmail.com>
Problem: 'linebreak' may still apply to leading whitespace
(VanaIgr)
Solution: Compare pointers instead of virtual columns.
(zeertzjq)
related: #27180closes: vim/vim#13915703f9bc943
Co-authored-by: VanaIgr <vanaigranov@gmail.com>
Problem: :drop does not re-use empty buffer
(Rocco Mao)
Solution: Make :drop re-use an empty buffer
(Rocco Mao)
fixes: vim/vim#13851closes: vim/vim#13881f96dc8d07f
Co-authored-by: Rocco Mao <dapeng.mao@qq.com>
Problem: ml_get: invalid lnum when :s replaces visual selection
(@ropery)
Solution: substitute may decrement the number of lines in a buffer,
so validate, that the bottom lines of the visual selection
stays within the max buffer line
fixes: vim/vim#13890closes: vim/vim#138927c71db3a58
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Missing test for Chuck filetype
after commit 27a4632af6753
(Christian Clason)
Solution: Add a filetype test
c1884c94c5
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Sharing queries with upstream and Helix is difficult due to
different capture names.
Solution: Define and document a new set of standard captures that
matches tree-sitter "standard captures" (where defined) and is closer to
Helix' Atom-style nested groups.
This is a breaking change for colorschemes that defined highlights based
on the old captures. On the other hand, the default colorscheme now
defines links for all standard captures (not just those used in bundled
queries), improving the out-of-the-box experience.
Problem: Modifying a hidden buffer still interferes with prompt buffer
mode changes.
Solution: Save and restore b_prompt_insert.
(zeertzjq)
closes: vim/vim#13875
Modifying hidden buffer still interferes with prompt buffer mode changes
f267847017
Problem: too vague errors for 'listchars'/'fillchars'
Solution: Include the field name in error message.
(zeertzjq)
related: #27050closes: vim/vim#138776a8d2e1634
Co-authored-by: Cole Frankenhoff <cole.nhf@gmail.com>
Problem: Insert mode not stopped if an autocommand modifies a hidden
buffer while closing a prompt buffer.
Solution: Don't set b_prompt_insert if stop_insert_mode is already set.
(zeertzjq)
closes: vim/vim#1387296958366ad
* vim-patch:9.1.0035: i_CTRL-] triggers InsertCharPre
Problem: i_CTRL-] triggers InsertCharPre
Solution: Return if CTRL-] is received. InsertCharPre
is supposed to be only used for chars to be inserted
but i_CTRL-] triggers expansion and is not inserted
into the buffer (altermo)
closes: vim/vim#13853closes: vim/vim#138647d711fe209
Problem: Modula2 filetype support lacking
Solution: Improve the Modula-2 runtime support, add additional modula2
dialects, add compiler plugin, update syntax highlighting,
include syntax tests, update Makefiles (Doug Kearns)
closes: vim/vim#6796closes: vim/vim#811568a8947069
- Luaify the detection script:
- Split the `(*!m2foo*)` and `(*!m2foo+bar*)` detection into two Lua patterns,
as Lua capture groups cannot be used with `?` and friends (as they only work
on character classes).
- Use `vim.api.nvim_buf_call()` (ew) to call `modula2#SetDialect()` to ensure
`b:modula2` is set for the given bufnr.
- Skip the syntax screendump tests. (A shame as they test some of the detection
from `(*!m2foo+bar*)` tags, but I tested this locally and it seems to work)
- Port the synmenu.vim changes from Vim9 script. (Also tested this locally)
- (And also add the missing comma for `b:browsefilter` from earlier.)
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: Vim is missing a foreach() func
Solution: Implement foreach({expr1}, {expr2}) function,
which applies {expr2} for each item in {expr1}
without changing it (Ernie Rael)
closes: vim/vim#12166e79e207760
Partial port as this doesn't handle non-materialized range() lists.
vim-patch:c92b8bed1fa6
runtime(help): delete duplicate help tag E741 (vim/vim#13861)
c92b8bed1f
Co-authored-by: Ernie Rael <errael@raelity.com>
Problem: Cannot easily get the list of matches
Solution: Add the matchstrlist() and matchbufline() Vim script
functions (Yegappan Lakshmanan)
closes: vim/vim#13766
Omit CHECK_LIST_MATERIALIZE(): it populates a List with numbers only,
and there is a check for strings below.
f93b1c881a
vim-patch:eb3475df0d92
runtime(doc): Replace non-breaking space with normal space (vim/vim#13868)
eb3475df0d
Co-authored-by: Yegappan Lakshmanan <4298407+yegappan@users.noreply.github.com>
Problem: i_CTRL-R- doesn't work for multibyte chars in Replace mode,
Coverity complains missing return value for u_save_cursor()
Solution: Use mb_charlen() and del_chars() instead, handle failure mode
for u_save_cursor() correctly (@zeertzjq)
closes: vim/vim#13846424ec1f235
Problem: i_CTRL-R- no longer works in replace mode
Solution: delete characters in replace mode before putting, add a test,
add a bit warning into the documentation, that i_CTRL-R-P/O
is not supported in Replace mode for now
fixes: vim/vim#13792closes: vim/vim#138165d5cbb2b9a
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Deleted lines go to wrong yank register.
Solution: Reset y_append when not calling get_yank_register(). (Christian
Brabandt, closesvim/vim#8872)
78eb9cce91
Nvim has removed y_append static variable and already works as expected.
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: default diff highlighting is too noisy
Solution: Link diff highlighting groups to new
Added/Removed/Changed, revert previous change
(Romain Lafourcade)
Remove diff* links added in vim/vim#13776 and doc added in commit b1392be
The links added in vim/vim#13776 are way too noisy for the contexts in which
the `diff` syntax is applied (git commits, patches, etc.).
This commit:
- removes those links
- adds new default highlighting groups Added, Changed and
Removed
- links the diff highlighting groups to those new defaults
- removes the doc changes
- adjusts the syntax_completion test for those newly added group
names
Note: Changes to the default color schemes will be handled separately,
by adding links to those newly created Added/Removed/Changed
highlighting groups.
related: vim/vim#13776closesvim/vim#13825124371c5a1
Co-authored-by: Romain Lafourcade <romain.lafourcade@razorfish.fr>
Problem: regexp cannot match combining chars in collection
Solution: Check for combining characters in regex collections for the
NFA and BT Regex Engine
Also, while at it, make debug mode work again.
fixesvim/vim#10286closes: vim/vim#12871d2cc51f9a1
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: regression with empty inner blocks introduced
(after v9.1.0007)
Solution: Set correct cursor position, Check for visual mode
being active (Maxim Kim)
relates: vim/vim#13514closes: vim/vim#138193779516988
Co-authored-by: Maxim Kim <habamax@gmail.com>
Problem: can select empty inner text blocks
(laurentalacoque)
Solution: make selecting empty inner text blocks an error
textobjects: Make selecting inner empty blocks an error
fixes: vim/vim#13514closes: vim/vim#13523ad4d7f446d
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Keymap completion is not available
Solution: Add keymap completion (Doug Kearns)
Add keymap completion to the 'keymap' option, user commands and builtin
completion functions.
closes: vim/vim#1369281642d9d6f
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Avoid `prevwin == curwin` when closing `curwin`
Problem: When closing the current window (or when moving it to a tabpage), the
previous window may refer to the new current window
(`winnr() == winnr('#')`) if that window is selected as the
new current window.
Solution: Set `prevwin = NULL` when switching away from an invalid `curwin` and
the target window was the `prevwin`.
(Sean Dewar)
related: vim/vim#4537closes: vim/vim#13762bf44b69d1f
Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
Problem: a closing fold expression may unexpectedly start a new fold
when it should end a fold
(reported by Shota Nozaki)
Solution: if a fold hasn't started yet, do not immediately
start a new fold with level 1
(Shota Nozaki)
fixes: vim/vim#12768closes: vim/vim#137480689b87059
Co-authored-by: Shota Nozaki <emonkak@gmail.com>
Problem: cursor wrong after { in single line buffer
(Edwin Chan)
Solution: do not place the cursor at the end for a single
line buffer when moving backwards
(Gary Johnson)
closes: vim/vim#13780closes: vim/vim#137839e6549d2fb
Co-authored-by: Gary Johnson <garyjohn@spocom.com>
Problem: Visual selection isn't drawn with 'breakindent' when the line
doesn't fit in the window (Jaehwang Jung)
Solution: Adjust wlv->fromcol also for 'breakindent' (zeertzjq)
closes: vim/vim#13767closes: vim/vim#1376823627722d3
Problem: no filetype detection for execline scripts
Solution: Add filetype detection for execline
as a prior to adding syntax support for execline (see
https://github.com/djpohly/vim-execline/issues/2), i went ahead and made
the filetype detection for execline scripts.
closes: vim/vim#13689
Signed-Off-By: Mazunki Hoksaas <rolferen@gmail.com>
63210c214a
Co-authored-by: Mazunki Hoksaas <rolferen@gmail.com>
Problem: Wrong cursor position when dragging out of window.
Solution: Don't use ScreenCols[] when mouse is not in current window.
closes: vim/vim#13717ec14924368
Problem: reg_executing() returns wrong result in :normal with range
when 'showcmd' is set (after 8.2.4705).
Solution: Reset "pending_end_reg_executing" when executing a register.
closes: vim/vim#13707615202bd0e
Problem: Moving tabpages on :drop may cause an endless loop
Solution: Disallow moving tabpages on :drop when cleaning up the arglist
first
Moving tabpages during drop command may cause an endless loop
When executing a :tab drop command, Vim will close all windows not in
the argument list. This triggers various autocommands. If a user has
created an 'au Tabenter * :tabmove -' autocommand, this can cause Vim to
end up in an endless loop, when trying to iterate over all tabs (which
would trigger the tabmove autocommand, which will change the tpnext
pointer, etc).
So instead of blocking all autocommands before we actually try to edit
the given file, lets simply disallow to move tabpages around. Otherwise,
we may change the expected number of events triggered during a :drop
command, which users may rely on (there is actually a test, that expects
various TabLeave/TabEnter autocommands) and would therefore be a
backwards incompatible change.
Don't make this an error, as this could trigger several times during the
drop command, but silently ignore the :tabmove command in this case (and
it should in fact finally trigger successfully when loading the given
file in a new tab). So let's just be quiet here instead.
fixes: vim/vim#13676closes: vim/vim#13686df12e39b8b
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: We have `P_(BOOL|NUM|STRING)` macros to represent an option's type, which is redundant because `OptValType` can already do that. The current implementation of option type flags is also too limited to allow adding multitype options in the future.
Solution: Remove `P_(BOOL|NUM|STRING)` and replace it with a new `type_flags` attribute in `vimoption_T`. Also do some groundwork for adding multitype options in the future.
Side-effects: Attempting to set an invalid keycode option (e.g. `set t_foo=123`) no longer gives an error.
Problem: The options[] array is not sorted alphabetically.
Solution: Sort it alphabetically. Add a test. Avoid unnecessary loop
iterations in findoption().
closes: vim/vim#13648
Cherry-pick Test_set_one_column() change from patch 8.2.0432.
f48558e10a
Problem: Confusing error for missing key.
Solution: Use the actualy key for the error. (closesvim/vim#9241)
5c1ec439f0
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: 'breakindent' is not drawn after diff filler lines.
Solution: Correct check for whether 'breakindent' should be drawn.
closes: vim/vim#13624588f20dece
Cherry-pick Test_diff_with_syntax() change from patch 9.0.1257.
Problem: Vim does not detect pacman.log file
Solution: Detect pacmanlogs and add syntax highlighting
pacman.log is a filetype common to Arch Liux and related distributions.
Add some simple syntax highlighting for the pacmanlog filetype.
closes: vim/vim#136181e5d66408e
Co-authored-by: Ronan Pigott <ronan@rjp.ie>
Problem: Wrong scrolling in Insert mode with 'smoothscroll' at the
bottom of the window.
Solution: Don't use set_topline() when 'smoothscroll' is set.
fixes: vim/vim#13612closes: vim/vim#136135b4d1fcbf0
Problem: Default color scheme is suboptimal.
Solution: Start using new color scheme. Introduce new `vim` color scheme
for opt-in backward compatibility.
------
Main design ideas
- Be "Neovim branded".
- Be minimal for 256 colors with a bit more shades for true colors.
- Be accessible through high enough contrast ratios.
- Be suitable for dark and light backgrounds via exchange of dark and
light palettes.
------
Palettes
- Have dark and light variants. Implemented through exporeted
`NvimDark*` and `NvimLight*` hex colors.
- Palettes have 4 shades of grey for UI elements and 6 colors (red,
yellow, green, cyan, blue, magenta).
- Actual values are computed procedurally in Oklch color space based on
a handful of hyperparameters.
- Each color has a 256 colors variant with perceptually closest color.
------
Highlight groups
Use:
- Grey shades for general UI according to their design.
- Bold text for keywords (`Statement` highlight group). This is an
important choice to increase accessibility for people with color
deficiencies, as it doesn't rely on actual color.
- Green for strings, `DiffAdd` (as background), `DiagnosticOk`, and some
minor text UI elements.
- Cyan as main syntax color, i.e. for function usage (`Function`
highlight group), `DiffText`, `DiagnosticInfo`, and some minor text UI
elements.
- Red to generally mean high user attention, i.e. errors; in particular
for `ErrorMsg`, `DiffDelete`, `DiagnosticError`.
- Yellow very sparingly only with true colors to mean mild user
attention, i.e. warnings. That is, `DiagnosticWarn` and `WarningMsg`.
- Blue very sparingly only with true colors as `DiagnosticHint` and some
additional important syntax group (like `Identifier`).
- Magenta very carefully (if at all).
------
Notes
- To make tests work without relatively larege updates, each one is
prepended with an equivalent of the call `:colorscheme vim`.
Plus some tests which spawn new Neovim instances also now use 'vim'
color scheme.
In some cases tests are updated to fit new default color scheme.
Problem: [security]: buffer-overflow in ex_substitute
Solution: clear memory after allocating
When allocating the new_start pointer in ex_substitute() the memory
pointer points to some garbage that the following for loop in
ex_cmds.c:4743 confuses and causes it to accessing the new_start pointer
beyond it's size, leading to a buffer-overlow.
So fix this by using alloc_clear() instead of alloc(), which will
clear the memory by NUL and therefore cause the loop to terminate
correctly.
Reported by @henices, thanks!
closes: vim/vim#13596abfa13ebe9
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: stack-buffer-overflow in option callback functions
Solution: pass size of errbuf down the call stack, use snprintf()
instead of sprintf()
We pass the error buffer down to the option callback functions, but in
some parts of the code, we simply use sprintf(buf) to write into the error
buffer, which can overflow.
So let's pass down the length of the error buffer and use sprintf(buf, size)
instead.
Reported by @henices, thanks!
b39b240c38
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: buffer-overflow in suggest_trie_walk
Solution: Check n before using it as index into byts array
Basically, n as an index into the byts array, can point to beyond the byts
array. So let's double check, that n is within the expected range after
incrementing it from sp->ts_curi and bail out if it would be invalid.
Reported by @henices, thanks!
0fb375aae6
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: use-after-free in win-enter
Solution: validate window pointer before calling win_enter()
win_goto() may stop visual mode, if it is active. However, this may in
turn trigger the ModeChanged autocommand, which could potentially free
the wp pointer which was valid before now became stale and points to now
freed memory.
So before calling win_enter(), let's verify one more time, that the
wp pointer still points to a valid window structure.
Reported by @henices, thanks!
eec0c2b3a4
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: html.angular ft is problematic
Solution: partly revert v9.0.2137
The html.angular filetype causes issues and does not trigger FileType
autocommands for the html or angular filetypes.
So let's roll back that particular change and detect this only as html
file
related: https://github.com/vim/vim/pull/13594#issuecomment-1834465890closes: vim/vim#136044f3480c943
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: ml_get error when scrolling after delete
Solution: mark topline to be validated in main_loop
if it is larger than current buffers line
count
reset_lnums() is called after e.g. TextChanged autocommands and it may
accidentally cause curwin->w_topline to become invalid, e.g. if the
autocommand has deleted some lines.
So verify that curwin->w_topline points to a valid line and if not, mark
the window to have w_topline recalculated in main_loop() in
update_topline() after reset_lnums() returns.
fixes: vim/vim#13568fixes: vim/vim#13578c4ffeddfe5
The error doesn't happen in Nvim because Nvim triggers TextChanged after
calling update_topline().
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: No test for mode() when executing Ex commands
Solution: Add some test cases and simplify several other test cases.
Also add a few more test cases for ModeChanged.
closes: vim/vim#13588fcaeb3d42b
Problem: not all nushell files detected
Solution: use *.nu to detect nushell files
closes: vim/vim#13586b9efc72c24
Co-authored-by: Daniel Buch Hansen <boogiewasthere@gmail.com>
Add syntax and filetype plugins for SWIG (Simplified Wrapper Interface
Generator) description files.
The default syntax for .i files highlights comments in a reverse
color scheme which doesn't look well. This syntax builds
on vim's c++ syntax by adding highlighting for common swig
directives and user defined directives. For an alternative
syntax, see vimscript vim/vim#1247 (which I found after writing this).
closes: vim/vim#135622e31065a65
Co-authored-by: Julien Marrec <julien.marrec@gmail.com>
Co-authored-by: Matěj Cepl <mcepl@cepl.eu>
09d4133 changed blocknr_T from long to int64_t, so pe_bnum is now always 64-bit. This was an incompatible change in the swapfile format for 32-bit systems, but there have been no complaints in the past 9 years so just adjust the test.
Problem: Unused assignments when checking the value of 'listchars'.
Solution: Loop only once when just checking the value. Add a test to
check that this change doesn't cause double-free.
closes: vim/vim#1355900624a2fa0
Problem: File info disappears immediately when 'cmdheight' has just
decreased due to switching tabpage and 'shortmess' doesn't
contain 'o' or 'O'.
Solution: Make sure msg_row isn't smaller than cmdline_row.
fixes: vim/vim#13560closes: vim/vim#1356140ed6711bd
Problem: [security]: use-after-free in ex_substitute
Solution: always allocate memory
closes: vim/vim#13552
A recursive :substitute command could cause a heap-use-after free in Vim
(CVE-2023-48706).
The whole reproducible test is a bit tricky, I can only reproduce this
reliably when no previous substitution command has been used yet
(which is the reason, the test needs to run as first one in the
test_substitute.vim file) and as a combination of the `:~` command
together with a :s command that contains the special substitution atom `~\=`
which will make use of a sub-replace special atom and calls a vim script
function.
There was a comment in the existing :s code, that already makes the
`sub` variable allocate memory so that a recursive :s call won't be able
to cause any issues here, so this was known as a potential problem
already. But for the current test-case that one does not work, because
the substitution does not start with `\=` but with `~\=` (and since
there does not yet exist a previous substitution atom, Vim will simply
increment the `sub` pointer (which then was not allocated dynamically)
and later one happily use a sub-replace special expression (which could
then free the `sub` var).
The following commit fixes this, by making the sub var always using
allocated memory, which also means we need to free the pointer whenever
we leave the function. Since sub is now always an allocated variable,
we also do no longer need the sub_copy variable anymore, since this one
was used to indicated when sub pointed to allocated memory (and had
therefore to be freed on exit) and when not.
Github Security Advisory:
https://github.com/vim/vim/security/advisories/GHSA-c8qm-x72m-q53q26c11c5688
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: The legacy signlist data structures and associated functions are
redundant since the introduction of extmark signs.
Solution: Store signs defined through the legacy commands in a hashmap, placed
signs in the extmark tree. Replace signlist associated functions.
Usage of the legacy sign commands should yield no change in behavior with the
exception of:
- "orphaned signs" are now always removed when the line it is placed on is
deleted. This used to depend on the value of 'signcolumn'.
- It is no longer possible to place multiple signs with the same identifier
in a single group on multiple lines. This will now move the sign instead.
Moreover, both signs placed through the legacy sign commands and through
|nvim_buf_set_extmark()|:
- Will show up in both |sign-place| and |nvim_buf_get_extmarks()|.
- Are displayed by increasing sign identifier, left to right.
Extmark signs used to be ordered decreasingly as opposed to legacy signs.
Problem: [security]: Use-after-free in win_close()
Solution: Check window is valid, before accessing it
If the current window structure is no longer valid (because a previous
autocommand has already freed this window), fail and return before
attempting to set win->w_closing variable.
Add a test to trigger ASAN in CI
25aabc2b8e
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: buffer-overflow in trunc_string()
Solution: Add NULL at end of buffer
Currently trunc_string() assumes that when the string is too long,
buf[e-1] will always be writeable. But that assumption may not always be
true. The condition currently looks like this
else if (e + 3 < buflen)
[...]
else
{
// can't fit in the "...", just truncate it
buf[e - 1] = NUL;
}
but this means, we may run into the last else clause with e still being
larger than buflen. So a buffer overflow occurs.
So instead of using `buf[e - 1]`, let's just always
truncate at `buf[buflen - 1]` which should always be writable.
3bd7fa12e1
vim-patch:9.0.2004: Missing test file
Problem: Missing test file
Solution: git-add the file to the repo
closes: vim/vim#13305d4afbdd071
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Trailing white space in tests
Solution: Delete it
This causes test_codestyle to fail, so we need to remove it again.
Hopefully that makes the CI green again.
Note: I will start using annotated tags from now on.
da200c2f78
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: tests running sh have problems
Solution: Check that dash is installed
closes: vim/vim#130401690ec64ff
Co-authored-by: Philip H <47042125+pheiduck@users.noreply.github.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: heap-buffer-overflow in vim_regsub_both
Solution: Disallow exchanging windows when textlock is active
f6d28fe2c9
Cherry-pick test_crash.vim change from patch 9.0.1876.
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: crash with bt_quickfix1_poc when cleaning up
and EXITFREE is defined
Solution: Test if buffer is valid in a window, else close
window directly, don't try to access buffer properties
While at it, increase the crash timeout slightly, so that CI has a
chance to finish processing the test_crash() test.
623ba31821
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: heap-use-after-free in bt_normal()
Solution: check that buffer is still valid
6e60cf444a
Test change only.
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: heap use after free in ins_compl_get_exp()
Solution: validate buffer before accessing it
ee9166eb3b
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: heap-use-after-free in is_qf_win()
Solution: Check buffer is valid before accessing it
fc68299d43
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: test_crash1() fails on CI
Solution: don't run Screendump test, verify that it doesn't crash
by running it through a shell command line, testing
the exit value and concatenating success cmd using '&&'
db510ca805
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: FPE in adjust_plines_for_skipcol
Solution: don't divide by zero, return zero
Prevent a floating point exception when calculating w_skipcol (which can
happen with a small window when the number option is set and cpo+=n).
Add a test to verify
cb0b99f067
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: overflow in get_number
Solution: Return 0 when the count gets too large
[security]: overflow in get_number
When using the z= command, we may overflow the count with values larger
than MAX_INT. So verify that we do not overflow and in case when an
overflow is detected, simply return 0
73b2d3790c
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: overflow in ex address parsing
Solution: Verify that lnum is positive, before substracting from
LONG_MAX
[security]: overflow in ex address parsing
When parsing relative ex addresses one may unintentionally cause an
overflow (because LONG_MAX - lnum will overflow for negative addresses).
So verify that lnum is actually positive before doing the overflow
check.
060623e4a3
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: overflow in nv_z_get_count
Solution: break out, if count is too large
When getting the count for a normal z command, it may overflow for large
counts given. So verify, that we can safely store the result in a long.
58f9befca1
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: overflow with count for :s command
Solution: Abort the :s command if the count is too large
If the count after the :s command is larger than what fits into a
(signed) long variable, abort with e_value_too_large.
Adds a test with INT_MAX as count and verify it correctly fails.
It seems the return value on Windows using mingw compiler wraps around,
so the initial test using :s/./b/9999999999999999999999999990 doesn't
fail there, since the count is wrapping around several times and finally
is no longer larger than 2147483647. So let's just use 2147483647 in the
test, which hopefully will always cause a failure
ac63787734
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Test for expanding "~" in substitute takes too long.
Solution: Disable the test for now.
916d6dd5b1
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Crash when expanding "~" in substitute causes very long text.
Solution: Limit the text length to MAXCOL.
ab9a2d884b
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: wast filetype should be replaced by wat filetype
Solution: start using the official wat filetype name
runtime: rename `wast` filetype to `wat` (Wasm text format)
The problem is the name of the current filetype wast. When the plugin
was initially created, the file extension for Wasm text format was not
fixed and .wast was more popular.
However, recently .wat became the official file extension for
WebAssembly text (WAT) format and .wast is now a file extension for the
unofficial WAST format, which is a superset of .wat for the convenience
to describe the Wasm specification conformance tests.
https://webassembly.js.org/docs/contrib-wat-vs-wast.html
However for now, let's keep using the `wat` filetype even for the .wast
extension, so that we at least do not lose the filetype settings and
syntax highlighting. This can be adjusted later, if it turns out to have
a separate need for.
closes: vim/vim#13533bc8f79d36a
Co-authored-by: rhysd <lin90162@yahoo.co.jp>
Problem: Text properties test fails when 'encoding' is not utf-8.
Solution: Compare with original value of 'encoding'. (Christian Brabandt,
closesvim/vim#3986)
ed79d1e348
Co-authored-by: Bram Moolenaar <Bram@vim.org>