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.