Commit Graph

27404 Commits

Author SHA1 Message Date
zeertzjq
366d0c7887
fix(move): check the correct buffer (#25698) 2023-10-18 10:34:55 +08:00
zeertzjq
bbc74d51ad
test(autocmd/termxx_spec): fix flakiness (#25694) 2023-10-18 07:19:29 +08:00
zeertzjq
4db4168aaf
vim-patch:8.2.4497: wrong color for half of wide character next to pum scrollbar (#25693)
Problem:    Wrong color for half of wide character next to pum scrollbar.
Solution:   Redraw the screen cell with the right color. (closes vim/vim#9874)

35d8c2010e

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-10-18 06:40:08 +08:00
zeertzjq
bc5dfda441
vim-patch:9.0.2041: trim(): hard to use default mask (#25692)
Problem:  trim(): hard to use default mask (partly revert v9.0.2040)
Solution: use default mask when it is empty

The default 'mask' value is pretty complex, as it includes many
characters.  Yet, if one needs to specify the trimming direction, the
third argument, 'trim()' currently requires the 'mask' value to be
provided explicitly.

Currently, an empty 'mask' will make 'trim()' call return 'text' value
that is passed in unmodified.  It is unlikely that someone is using it,
so the chances of scripts being broken by this change are low.

Also, this reverts commit 9.0.2040 (which uses v:none for the default
and requires to use an empty string instead).

closes: vim/vim#13358

8079917447

vim-patch:9.0.2040: trim(): hard to use default mask

Problem:  trim(): hard to use default mask
Solution: Use default 'mask' when it is v:none

The default 'mask' value is pretty complex, as it includes many
characters.  Yet, if one needs to specify the trimming direction, the
third argument, 'trim()' currently requires the 'mask' value to be
provided explicitly.

'v:none' is already used to mean "use the default argument value" in
user defined functions.  See |none-function_argument| in help.

closes: vim/vim#13363

6e6386716f

Co-authored-by: Illia Bobyr <illia.bobyr@gmail.com>
2023-10-18 06:08:14 +08:00
Maria José Solano
3fd7449d5a
fix(treesitter): check that buf is loaded in autocommands (#25679) 2023-10-17 15:34:39 -05:00
zeertzjq
272ef27115
vim-patch:9.0.2035: [security] use-after-free with wildmenu (#25687)
Problem:  [security] use-after-free with wildmenu
Solution: properly clean up the wildmenu when exiting

Fix wildchar/wildmenu/pum memory corruption with special wildchar's

Currently, using `wildchar=<Esc>` or `wildchar=<C-\>` can lead to a
memory corruption if using wildmenu+pum, or wrong states if only using
wildmenu. This is due to the code only using one single place inside the
cmdline process loop to perform wild menu clean up (by checking
`end_wildmenu`) but there are other odd situations where the loop could
have exited and we need a post-loop clean up just to be sure. If the
clean up was not done you would have a stale popup menu referring to
invalid memory, or if not using popup menu, incorrect status line (if
`laststatus=0`).

For example, if you hit `<Esc>` two times when it's wildchar, there's a
hard-coded behavior to exit command-line as a failsafe for user, and if
you hit `<C-\><C-\><C-N>` it will also exit command-line, but the clean
up code would not have hit because of specialized `<C-\>` handling.

Fix Ctrl-E / Ctrl-Y to not cancel/accept wildmenu if they are also
used for 'wildchar'/'wildcharm'. Currently they don't behave properly,
and also have potentially memory unsafe behavior as the logic is
currently not accounting for this situation and try to do both.
(Previous patch that addressed this: vim/vim#11677)

Also, correctly document Escape key behavior (double-hit it to escape)
in wildchar docs as it's previously undocumented.

In addition, block known invalid chars to be set in `wildchar` option,
such as Ctrl-C and `<CR>`. This is just to make it clear to the user
they shouldn't be set, and is not required for this bug fix.

closes: vim/vim#13361

8f4fb007e4

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-17 22:43:42 +08:00
zeertzjq
356a6728ac
vim-patch:9.0.2037: A few remaining cmdline completion issues with C-E/Y (#25686)
Problem:  A few remaining cmdline completion issues with C-E/Y
Solution: Fix cmdline completion fuzzy/Ctrl-E/Ctrl-Y/options when not
          used at the end

Fix cmdline completion fuzzy/Ctrl-E/Ctrl-Y/options when not used at the end

A few places in the cmdline completion code only works properly when the
user hits Tab (or 'wildchar') at the end of the cmdline, even though
it's supposed to work even in the middle of the line.

For fuzzy search, `:e ++ff`, and `:set hl=`, fix completion code to make
sure to use `xp_pattern_len` instead of assuming the entire `xp_pattern`
is the search pattern (since it contains texts after the cursor).

Fix Ctrl-E / Ctrl-Y to not jump to the end when canceling/accepting a
wildmenu completion. Also, make them work even when not using
`set wildoptions+=pum` as there is no drawback to doing so.
(Related issue where this was brought up: vim/vim#13331)

closes: vim/vim#13362

209ec90b9b

Cherry-pick ex_getln.c changes from patch 9.0.2035.

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-17 21:42:34 +08:00
zeertzjq
c9963e2212
vim-patch:9.0.2039: completion shows current word after completion restart (#25682)
Problem:  completion shows current word after completion restart
Solution: remove the word being completed after completion restart

The word being completed is shown in a completion list after completion
restart, because it isn't removed from the current buffer before
searching for matches.

Also adjust `Test_complete_add_onechar` to match the new behavior.

closes: vim/vim#13349

2e3cd52fa0

Co-authored-by: nwounkn <nwounkn@gmail.com>
2023-10-17 17:49:22 +08:00
Jaehwang Jung
35f475d0a5
fix(diagnostics): if buffer not loaded, skip handlers that set extmark (#25628)
Problem:
When enabling diagnostics, there can be diagnostics for unloaded buffer,
but some handlers nevertheless attempt to set extmarks in such buffers.

Solution:
* Exit underline/virtual_text handler if buffer is not loaded.
* Don't require is_loaded as precondition for show(), because handlers
  don't necessarily depend on it.
2023-10-16 20:51:36 -05:00
bfredl
a63c67005b
Merge pull request #25394 from famiu/refactor/options/set_option
refactor(options)!: unify interfaces for setting options
2023-10-16 20:41:35 +02:00
dundargoc
b80a8e2c16 build: adjust how find order is prioritized
Ensure bundled libraries and include directories are always searched
first before any others. This will provide a more consistent experience
as the search order of the builtin find_ functions can vary depending on
system. This should make the build process faster when building with
bundled deps as we limit the search to only the .deps directory.
Separating the search between .deps and everything makes debugging
find_-related problems simpler if you need to check how dependencies are
found.

For libraries, we divide the search process into the following order:
1. Only search in .deps directory and only search for static libraries.
2. Only search in .deps directory and search for all libraries.
3. Search everywhere and search for all libraries.

Make an exception for FindLibintl.cmake as changing the search order
seems to break some tests on macos.
2023-10-16 20:15:41 +02:00
Famiu Haque
3642f2fb44 refactor(options): make did_set_shada a normal option callback 2023-10-17 00:08:47 +06:00
Famiu Haque
f1a58a8dcc refactor(options): make os_oldval and os_newval use OptValData 2023-10-17 00:08:47 +06:00
Famiu Haque
af010e23f3 refactor(options): rename empty_option to empty_string_option 2023-10-17 00:08:47 +06:00
Famiu Haque
526234cf56 refactor(options): deduplicate the do_set_option codepath 2023-10-17 00:08:47 +06:00
Famiu Haque
ca77089e2d refactor(options): deduplicate do_set_option_string
Reduce code duplication between `do_set_option_string` and `set_string_option` by making the former call the latter within itself.
2023-10-17 00:08:47 +06:00
Famiu Haque
36e4901cbd refactor(options): remove os_op 2023-10-17 00:08:47 +06:00
Famiu Haque
5df4fdf253 refactor(options)!: make OptionSet v: values use typval
BREAKING CHANGE: This breaks the OptionSet autocommand, as the `v:` values associated with it (`v:option_new`, `v:option_old`, `v:option_oldlocal` and `v:option_oldglobal`) are now the same type as the option, instead of all option values being converted to strings.
2023-10-17 00:08:47 +06:00
Famiu Haque
93b9c88946 refactor(options): unify set_num_option and set_bool_option 2023-10-17 00:08:47 +06:00
James Barford-Evans
a4c4b39d55
fix(man.lua): hardwrapped manpage is not resized #25646
Problem:
If a manpage is opened, its hardwrapped dimensions are not recalculated
after closing then revisiting the same manpage.

Solution:
Unload the manpage when it is hidden. This forces it to be reloaded,
which forces the hard-wrapping to be recalculated when it is revisited.

Fixes: #25457
2023-10-16 09:59:33 -07:00
Maria José Solano
2eecb1b85d
fix(lsp): highlight active parameter in signature help #25663
Fixes #25662
2023-10-16 08:52:48 -07:00
Maria José Solano
c46a6c065e
docs: do not hardcode LSP version in URL #25648 2023-10-16 08:13:37 -07:00
zeertzjq
0892c1cd94
vim-patch:9.0.2033: gcc overflow-warning for f_resolve (#25666)
Problem:  gcc overflow-warning for f_resolve
Solution: use pointer p instead of pointer q[-1]

Suppress the following warning:
```
filepath.c: In function ‘f_resolve’:
filepath.c:2162:27: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 2162 |                     q[-1] = NUL;
```

Closes: vim/vim#13352
closes: vim/vim#13353

215c3261a2

Co-authored-by: Ken Takata <kentkt@csc.jp>
2023-10-16 16:41:17 +08:00
zeertzjq
3222f0ad00
vim-patch:dbf749bd5aae (#25665)
runtime: Fix more typos (vim/vim#13354)

* Fix more typos

* Fix typos in ignored runtime/ directory

dbf749bd5a

Co-authored-by: Viktor Szépe <viktor@szepe.net>
2023-10-16 16:36:25 +08:00
bfredl
0a3505eb9d
Merge pull request #25602 from bfredl/have_no_ifdef
refactor(lang): reduce scope of HAVE_WORKING_LIBINTL #ifdefs
2023-10-15 18:48:22 +02:00
bfredl
3a44db510b refactor(lang): reduce scope of HAVE_WORKING_LIBINTL #ifdefs
A lot of code inside HAVE_WORKING_LIBINTL doesn't really depend on a
"working libintl". For instance ex_language is also used for ":lang collate"
and ":lang time".

Also ":lang C" should not fail just because translations aren't available (it
just means use the default text).

References:

https://github.com/neovim/neovim/pull/1 2d00ead2e5
separate ifdefs for locale and gettext got merged together.

8253e29971
Unmotivated switcharoo of get_mess_env() logic. If available, get_locale_val(LC_MESSAGES) is the correct implementation.
2023-10-15 14:17:50 +02:00
zeertzjq
0818d65528
fix(extmarks): skip virt_text if it is out of window (#25658) 2023-10-15 19:36:19 +08:00
zeertzjq
75b488d3ef
vim-patch:9.0.2025: no cmdline completion for ++opt args (#25657)
Problem:  no cmdline completion for ++opt args
Solution: Add cmdline completion for :e ++opt=arg and :terminal
          [++options]

closes: vim/vim#13319

989426be6e

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-15 17:52:08 +08:00
zeertzjq
d974a3dcbb
vim-patch:9.0.2032: cannot get mouse click pos for tab or virt text (#25653)
Problem:  Cannot accurately get mouse clicking position when clicking on
          a TAB or with virtual text.
Solution: Add a "coladd" field to getmousepos() result.

closes: vim/vim#13335

f5a94d5165
2023-10-15 17:19:01 +08:00
zeertzjq
a350fb2976
vim-patch:9.0.2031: TextChangedI may be triggered by non-insert mode change (#25656)
Problem:  `TextChangedI` can trigger on entering Insert mode if there
          was previously a change not in Insert mode.
Solution: Make it trigger only when text is actually changed in Insert
          mode.

closes: vim/vim#13265
closes: vim/vim#13338

d7ae263af8

Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
2023-10-15 17:14:18 +08:00
zeertzjq
e5a424d78e
vim-patch:9.0.2030: no max callback recursion limit (#25655)
Problem:  no max callback recursion limit
Solution: bail out, if max call recursion for callback functions
          has been reached.

This checks the 'maxfuncdepth' setting and throws E169 when a callback
function recursively calls itself.

closes: vim/vim#13337
closes: vim/vim#13339

47510f3d65

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-15 17:02:17 +08:00
zeertzjq
aa62579a68
docs: restore accidentally removed line in :h 'ignorecase' (#25651) 2023-10-15 09:05:27 +08:00
zeertzjq
85ddd0074b
test(terminal/channel_spec): fix flakiness (#25649) 2023-10-15 06:38:43 +08:00
Christian Clason
28ef4a4492 vim-patch:7687238e1b0d
runtime(tcsh): Update ftplugin (vim/vim#13327)

Fix b:browsefilter deletion error when calling b:undo_ftplugin.

Fixes vim/vim#13167

7687238e1b

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-10-14 17:07:09 +02:00
Christian Clason
729a9c4c61 vim-patch:9.0.2024: no filetype detection for Debian sources
Problem:  no filetype detection for Debian sources
Solution: Add new deb822sources filetype

closes: vim/vim#13320

bd734c3bea

Co-authored-by: James McCoy <jamessan@jamessan.com>
2023-10-14 16:41:33 +02:00
zeertzjq
af4985feda
test(winscrolled): make sure floating window is drawn (#25639) 2023-10-14 20:09:49 +08:00
zeertzjq
20dacacf37
vim-patch:2bbd0d30eebd (#25637)
runtime(doc): Improve command-line completion docs (vim/vim#13331)

* Improve command-line completion docs

Add more details about 'ignorecase' and its effect on cmdline
completion.

Make sure keys used in wildmenu are properly documented and linked in the
keys' documentation entries, and in `:h index` for proper
cross-referencing, as wildmenu popup is slightly different from
insert-mode popup menu.

* Fix docs typos

2bbd0d30ee

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-14 19:28:41 +08:00
zeertzjq
bcda800933
vim-patch:9.0.2022: getmousepos() returns wrong index for TAB char (#25636)
Problem:  When clicking in the middle of a TAB, getmousepos() returns
          the column of the next char instead of the TAB.
Solution: Break out of the loop when the vcol to find is inside current
          char. Fix invalid memory access when calling virtcol2col() on
          an empty line.

closes: vim/vim#13321

b583eda703
2023-10-14 19:18:25 +08:00
zeertzjq
99b1163b5a
vim-patch:9.0.2021: Coverity complains about change in charset (#25634)
Problem:  Coverity complains about change in charset (after v9.0.2017)
Solution: check pointer t at index 0

closes: vim/vim#13322

cd6ee69358

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-14 18:39:24 +08:00
Mathias Fußenegger
57ce9b6a92
refactor(lsp): fix luals warnings in tagfunc and add type annotations (#25150) 2023-10-14 11:31:16 +02:00
Mathias Fußenegger
712adacdf5
refactor(lsp): make is_pull in lsp.diagnostic.get_namespace optional (#25156)
Follw up to 63b3408551

`is_pull` should be optional, otherwise it is an API change that
introduces warnings in consumers.

Also fixes the type annotation of `_client_pull_namespaces` where the
key is a string.
2023-10-14 09:47:20 +02:00
Maria José Solano
ee156ca60e
fix(lsp): refactor escaping snippet text (#25611) 2023-10-14 09:06:40 +02:00
zeertzjq
8ee8112b92
Merge pull request #25630 from nwounkn/fix-extra-line
fix(ui): empty line before the next message after :silent command
2023-10-14 14:55:01 +08:00
nwounkn
13f55750e9 fix(ui): empty line before the next message after :silent command
Problem:
  The next command after `silent !{cmd}` or `silent lua print('str')`
  prints an empty line before printing a message, because these commands
  set `msg_didout = true` despite not printing any messages.

Solution:
  Set `msg_didout = true` only if `msg_silent == 0`
2023-10-14 14:23:08 +08:00
zeertzjq
ce0f80835a
test(ui/searchhl_spec): match more in :terminal test (#25631) 2023-10-14 13:53:52 +08:00
zeertzjq
bf70a33f5e
vim-patch:8.1.0822: peeking and flushing output slows down execution (#25629)
Problem:    Peeking and flushing output slows down execution.
Solution:   Do not update the mode message when global_busy is set.  Do not
            flush when only peeking for a character. (Ken Takata)

cb574f4154
2023-10-14 09:58:30 +08:00
zeertzjq
9f32deba56
fix(grid): add start column when getting char on line (#25627) 2023-10-13 21:43:06 +08:00
Jongwook Choi
ebe489d8f0
fix: allow multiline message for echoerr (#25380)
PROBLEM:

Currently `:echoerr` prints multi-line strings in a single line
as `:echom` does (Note: `:echon` can print multi-line strings well).
This makes stacktrace printed via echoerr difficult to read.

Example code:

    try
      lua error("lua stacktrace")
    catch
      echoerr v:exception
    endtry

Output:

    Error detected while processing a.vim[5]..a.vim:
    line    4:
    Vim(lua):E5108: Error executing lua [string ":lua"]:1: lua stacktrace^@stack traceback:^@^I[C]: in function 'error'^@^I[string ":lua"]:1: in main chunk

SOLUTION:

Allow echoerr to print multiline messages (e.g., lua exceptions),
because this command is usually used to print stacktraces.

Output after the fix:

    Error detected while processing a.vim[5]..a.vim:
    line    4:
    Vim(lua):E5108: Error executing lua [string ":lua"]:1: lua stacktrace
    stack traceback:
            [C]: in function 'error'
            [string ":lua"]:1: in main chunk
2023-10-13 07:27:45 +08:00
Justin M. Keyes
2c9f22e7e4
refactor(test): cleanup #25614
- unnecessary separate describe() group
- clear() wasn't called in the describe() group
- unnecessary indirection in function parameters
2023-10-12 07:04:16 -07:00
L Lllvvuu
9c2270b834 feat(types): add test/.luarc.json
Authored-By: Lewis Russell <lewis6991@gmail.com>
Co-Authored-By: Lewis Russell <lewis6991@gmail.com>
2023-10-12 09:50:29 +01:00