Without this change, pressing K while in one manpage to load another
one, then pressing CTRL-O to go back, results in going to the bottom of
the current (second) manpage. With this change, it goes back to the
previous manpage.
closes: #16791
Signed-off-by: David Mandelberg <david@mandelberg.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
see :help E499 and :h key-notation
closes: #16795
Signed-off-by: Konfekt <Konfekt@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: when the file 'TestCommand?Test' exists,
'Test_complete_cmdline()' will fail when writing the file. And
there's no related cleaning operation for this kind of file
before the test run.
Solution: modify `write` to `write!` to override (Jim Zhou).
closes: #16799
Signed-off-by: Jim Zhou <jimzhouzzy@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: ABNF files are not detected
Solution: detect '.abnf' file as abnf filetype and
include an abnf syntax plugin (A4-Tacks).
References:
- RFC5234
- RFC7405
closes: #16802
Signed-off-by: A4-Tacks <wdsjxhno1001@163.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: heap-buffer-overflow with 'nostartofline' and Ex command in
tag file.
Solution: Set cursor column when moving cursor to line 1 (zeertzjq).
closes: #16796
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: wildmenu highlighting in popup can be improved
Solution: Check if the completion items contain submatches of the
entered text (Girish Palya).
This update enables highlighting in the popup menu even when the matched
fragment or pattern appears within an item (string) rather than only at the
beginning. This is especially useful for custom completion, where menu items
may not always start with the typed pattern.
For specific use cases, refer to the two examples in
https://github.com/vim/vim/pull/16759
A sliding window approach is used with direct string comparison. Performance
is not a concern, as highlighting is applied only to displayed lines, even if
the menu list is arbitrarily long.
closes: #16785
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: using global variable for get_insert()/get_lambda_name()
(after v9.1.1151)
Solution: let the functions return a string_T object instead
(Yee Cheng Chin)
In #16720, `get_insert()` was modified to store a string length in a
global variable to be queried immediately by another `get_insert_len()`
function, which is somewhat fragile. Instead, just have the function
itself return a `string_T` object instead. Also do the same for
`get_lambda_name()` which has similar issues.
closes: #16775
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: wrong flags passed down to nextwild()
(zeertzjq, after v9.1.1166)
Solution: only pass options flags (Girish Palya)
`options` needs to be passed into nextwild() since it may contain
WILD_KEEP_SOLE_ITEM which prevents the menu items list from getting
freed if there is only 1 item left (if `noselect` is set).
closes: #16778
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: mark '] wrong after copying text object (ubaldot)
Solution: Adjust position of '] for non-linewise, exclusive motions
(Jim Zhou)
related: #16679closes: #16772
Signed-off-by: Jim Zhou <jimzhouzzy@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: command-line auto-completion hard with wildmenu
Solution: implement "noselect" wildoption value (Girish Palya)
When `noselect` is present in `wildmode` and 'wildmenu' is enabled, the
completion menu appears without pre-selecting the first item.
This change makes it easier to implement command-line auto-completion,
where the menu dynamically appears as characters are typed, and `<Tab>`
can be used to manually select an item. This can be achieved by
leveraging the `CmdlineChanged` event to insert `wildchar(m)`,
triggering completion menu.
Without this change, auto-completion using the 'wildmenu' mechanism is
not feasible, as it automatically inserts the first match, preventing
dynamic selection.
The following Vimscript snippet demonstrates how to configure
auto-completion using `noselect`:
```vim
vim9script
set wim=noselect:lastused,full wop=pum wcm=<C-@> wmnu
autocmd CmdlineChanged : timer_start(0, function(CmdComplete, [getcmdline()]))
def CmdComplete(cur_cmdline: string, timer: number)
var [cmdline, curpos] = [getcmdline(), getcmdpos()]
if cur_cmdline ==# cmdline # Avoid completing each character in keymaps and pasted text
&& !pumvisible() && curpos == cmdline->len() + 1
if cmdline[curpos - 2] =~ '[\w*/:]' # Reduce noise by completing only selected characters
feedkeys("\<C-@>", "ti")
set eventignore+=CmdlineChanged # Suppress redundant completion attempts
timer_start(0, (_) => {
getcmdline()->substitute('\%x00$', '', '')->setcmdline() # Remove <C-@> if no completion items exist
set eventignore-=CmdlineChanged
})
endif
endif
enddef
```
fixes: #16551closes: #16759
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim's diff block merging algorithm when doing a multi-file diff
is buggy when two different diff hunks overlap a single
existing diff block (after v9.1.0743)
Solution: fix a couple bugs in this logic:
1. Fix regression from v9.1.0743 where it's not correctly expanding the
2nd overlap correctly, where it always expands without taking into
account that this was always taken care of when the first overlap
happened. Instead, we should only grow the 2nd overlap if it overhangs
outside the existing diff block, and if we encounter a new overlapping
diff block (due to overlap chaining).
2. When we expand a diff block to match the hunk size on the orig side
(when handling the first overlap), we expand the same amount of lines
in the new side. This is not sound if there exists a second overlap
hunk that we haven't processed yet, and that hunk has different
number of lines in orig/new. Fix this by doing the corresponding
counter adjustment when handling 2nd/3rd/etc overlap by calculating
the difference in lines between orig and new side.
(Yee Cheng Chin)
closes: #16768
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: $MYVIMDIR is set too late and not available while sourcing
runtime files (Maxim Kim, after v9.1.1159)
Solution: Also set it when $MYVIMRC file is found
fixes: #16764closes: #16767
Signed-off-by: Christian Brabandt <cb@256bit.org>
The current lightweight synchronisation with ":redraw" needs further
reinforcement in the light of v9.1.1110. And, with v9.1.0820, make
another synchronisation point _before_ the first (or only) screenful is
dumped.
Also add a script to regenerate all screendumps.
closes: #16632
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When an info popup spans into the cmdline area and ESC is
pressed, some content remains visible on screen (yu3s)
Solution: Add popup_overlays_cmdline() check in screen_fill() to prevent
prematurely clearing the clear_cmdline flag (glepnir).
fixes: #15627closes: #16765
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: preinsert requires bot "menu" and "menuone" to be set,
but "menu" is redundant (after v9.1.1160)
Solution: preinsert only requires menuone (glepnir)
closes: #16763
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: The 'preinsert' feature requires Ctrl-Y to confirm insertion,
but Ctrl-Y only works when the popup menu (pum) is displayed.
Without enforcing this dependency, it could lead to confusing
behavior or non-functional features.
Solution: Modify ins_compl_has_preinsert() to check for both 'menu' and
'menuone' flags when 'preinsert' is set. Update documentation
to clarify this requirement. This avoids adding complex
conditional behaviors. (glepnir)
fixes: #16728closes: #16753
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: $MYVIMDIR may not always be set (after 9.1.0718)
(sandwm)
Solution: always set $MYVIMDIR to first item in runtimepath
(except when using --clean), update it when changing &rtp
fixes: #16609closes: #16709
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: :verbose set has wrong file name with :compiler!
Solution: Add -keepscript (zeertzjq)
closes: #16752
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: No test for what patch 9.1.1152 fixes.
Solution: Add a test (zeertzjq).
closes: #16742
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Prevent 'include' from matching variable assignments as calls to
require() and others.
- Use script-local functions for 'includeexpr' and 'foldexpr'.
- Formatting fixes.
closes: #16746
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Match Vim9 function calls after ex-bar. These are also currently
matched but invalid syntax for legacy script.
fixes: #16721closes: #16747
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim9: not able to use autoload class accross scripts
Solution: make it work, re-enable the test (Yegappan Lakshmanan)
fixes: #15031closes: #16748
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: too many strlen() calls in getchar.c
Solution: store last inserted and recorded lengths,
add functions to retrieve those and use those
functions (John Marriott)
closes: #16720
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: :highlight auto-complettion has a minor bug where an existing
highlight group with a cterm color being unset would result in
it being auto-completed to -1 in cmdline which is invalid.
Solution: Correctly check for whether an int value is set to non-zero
before retrieving the existing value for auto-complete. Also
do this for attr/string values as they previously worked only
by accident (Yee Cheng Chin).
closes: #16726
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Unix Makefile does not support Brazilian lang for the
installer
Solution: add support for language code pt_br (RestorerZ)
This is in preparation of the Portuguese Brazilian translation
that will be merged a bit later.
related: #16692closes: #16732
Signed-off-by: RestorerZ <restorer@mail2k.ru>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem:
- The doc says the default `g:lua_subversion` is 2, but in fact it is 3
(see `runtime/syntax/lua.vim`)
- `includeexpr` doesn't work with module in `init.lua`
Solution:
- Update documentation
- Assign value to option `&include`
- Add function `LuaInclude` and assign it to `l:&includeexpr`
closes: #16655
Co-authored-by: dkearns <dougkearns@gmail.com>
Signed-off-by: brianhuster <phambinhanctb2004@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: preview-window does not scroll correctly
Solution: init firstline = 0 for a preview window
(Girish Palya)
The 'info' window, which appears during insert-mode completion to display
additional information, was not scrolling properly when using commands like:
win_execute(popup_findinfo(), "normal! \<PageDown>")
This issue made it impossible to navigate through info window contents using
keyboard-based scrolling.
The fix correctly updates the w_firstline value of the popup window, ensuring
proper scrolling behavior. Mouse scrolling was already working as expected and
remains unaffected.
closes: #16703
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Prepare for PR #16692 which will eventually bring pt-br translation to
the installer and add some clarification on how to test the installer
with different languages
closes: #16725
Signed-off-by: RestorerZ <restorer@mail2k.ru>
Signed-off-by: Christian Brabandt <cb@256bit.org>