Commit Graph

27618 Commits

Author SHA1 Message Date
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
zeertzjq
840e1864c2
fix(lsp): handle NUL bytes in popup text (#25612)
Fix #25610
2023-10-12 15:39:39 +08:00
zeertzjq
d2d38858d1
vim-patch:9.0.2018: complete_info() returns wrong index (#25607)
Problem:  complete_info() returns wrong index
Solution: Make order of 'info' in completion_info consistent

Start the iteration from the same point and follow the same direction as
done when assigning the completion numbers. This way we remove the
dependence on the completion direction and make the order of 'info'
consistent.

closes: vim/vim#12230
closes: vim/vim#12971

69fb5afb3b

Co-authored-by: LemonBoy <thatlemon@gmail.com>
2023-10-12 08:21:01 +08:00
zeertzjq
3cbb02ce77
vim-patch:8.2.3064: Vim9: in script cannot set item in uninitialized list (#25605)
Problem:    Vim9: in script cannot set item in uninitialized list.
Solution:   When a list is NULL allocate an empty one. (closes vim/vim#8461)

e65081d1b5

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-10-12 07:38:56 +08:00
zeertzjq
f4c85b9ad1
Merge pull request #25606 from zeertzjq/vim-9.0.2017 2023-10-12 07:34:14 +08:00
zeertzjq
dac79b165d vim-patch:9.0.2017: linebreak applies for leading whitespace
Problem:  linebreak applies for leading whitespace
Solution: only apply linebreak, once we have found non-breakat chars in
          the line

closes: vim/vim#13228
closes: vim/vim#13243

dd75fcfbdf

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-12 07:02:49 +08:00
zeertzjq
e2406d119f
vim-patch:9.0.2017: linebreak applies for leading whitespace (#25604)
Problem:  linebreak applies for leading whitespace
Solution: only apply linebreak, once we have found non-breakat chars in
          the line

closes: vim/vim#13228
closes: vim/vim#13243

dd75fcfbdf

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-12 06:49:11 +08:00
Christian Clason
7474874baa vim-patch:9.0.2011: INI files not detected
Problem:  INI files not detected
Solution: detect uppercase .INI as dosini files

It previo~1 only worked for lower-case .ini files, but upperc~1 .INI is
also somewhat common on account of DOS' old 8.3 upperc~2 only filena~1.

closes: vim/vim#13316

4a82bdfaa8

Co-authored-by: Martin Tournoij <martin@arp242.net>
2023-10-11 23:54:41 +02:00
Maria José Solano
2fde6295df
fix(lsp): display initialization errors (#25409) 2023-10-11 15:38:58 -05:00
sisrfeng
37da0bc0c6
docs: clarify about error in shada (#25594) 2023-10-11 17:58:07 +08:00
Raphael
f79052faef
refactor(float): rename ex_floatclose to ex_fclose (#25596) 2023-10-11 15:03:59 +08:00
zeertzjq
4eea60939f
test(core/path_spec): don't use fnameescape() (#25593)
Using fnameescape() for the path argument of findfile() and finddir() is
wrong, as fnameescape() is intended to be used for parts of Ex commands,
not function arguments.
2023-10-11 07:24:37 +08:00
Famiu Haque
c4f8be464c docs(style): add guideline for fixing compiler error on switch statement
Problem: Certain compilers (primarily GCC) do not recognize an exhaustive enum switch statement as being exhaustive. This manifests in the form of compiler errors in exhaustive switch statements where each case has a return statement but there isn't a catch-all return statements. These compiler errors are spurious in the context of the Neovim codebase. So #25533 added the `UNREACHABLE` macro to denote apart of the code that's unreachable, which was used after every such switch statement to tell the compiler to treat the switch statement as exhaustive. However, the macro is mentioned nowhere in the style guide,and new contributors would not have any natural way of learning about it as it stands now. This would lead to confusion when they inevitably encounter one of these compiler errors.

Solution: Add a style guideline which shows how to use the `UNREACHABLE` macro to fix these compiler errors.
2023-10-10 22:23:54 +02:00
dundargoc
c3d21ad1bc docs: small fixes
Co-authored-by: Wansmer <wansmer@gmail.com>
Co-authored-by: Andrew Voynov <andrewvoynov.b@gmail.com>
Co-authored-by: David Moberg <david.moberg@mediatek.com>
2023-10-10 19:20:32 +02:00
bfredl
fd39f5ce8c
Merge pull request #25561 from glepnir/9663
feat(float): add fclose command
2023-10-10 16:36:55 +02:00
James
468a3a1407
refactor: use xstpcpy() instead of strcat() (#25572) 2023-10-10 22:03:55 +08:00
glepnir
372aa2eb3d feat(float): add fclose command 2023-10-10 21:17:08 +08:00
Famiu Haque
9ff6f73f83 refactor: allow not having a default case for enum
Problem: The style guide states that all switch statements that are not conditional on an enum must have a `default` case, but does not give any explicit guideline for switch statements that are conditional on enums. As a result, a `default` case is added in many enum switch statements, even when the switch statement is exhaustive. This is not ideal because it removes the ability to have compiler errors to easily detect unchanged switch statements when a new possible value for an enum is added.

Solution: Add explicit guidelines for switch statements that are conditional on an enum, clarifying that a `default` case is not necessary if the switch statement is exhaustive. Also refactor pre-existing code with unnecessary `default` cases.
2023-10-10 11:19:41 +01:00
Evgeni Chasnovski
a2f17e97ec
fix(highlight): add FloatFooter to 'highlight_defs.h' (#25577) 2023-10-10 17:33:30 +08:00
zeertzjq
c40a1c0f41
vim-patch:9.0.2009: cmdline-completion for comma-separated options wrong (#25569)
Problem:  cmdline-completion for comma-separated options wrong
Solution: Fix command-line expansions for options with filenames with
          commas

Fix command-line expansions for options with filenames with commas

Cmdline expansion for option values that take a comma-separated list
of file names is currently not handling file names with commas as the
commas are not escaped. For such options, the commas in file names need
to be escaped (to differentiate from a comma that delimit the list
items). The escaped comma is unescaped in `copy_option_part()` during
option parsing.

Fix as follows:
- Cmdline completion for option values with comma-separated file/folder
  names will not start a new match when seeing `\\,` and will instead
  consider it as one value.
- File/folder regex matching will strip the `\\` when seeing `\\,` to
  make sure it can match the correct files/folders.
- The expanded value will escape `,` with `\\,`, similar to how spaces
  are escaped to make sure the option value is correct on the cmdline.

This fix also takes into account the fact that Win32 Vim handles file
name escaping differently. Typing '\,' for a file name results in it
being handled literally but in other platforms '\,' is interpreted as a
simple ',' and commas need to be escaped using '\\,' instead.

Also, make sure this new logic only applies to comma-separated options
like 'path'. Non-list options like 'set makeprg=<Tab>' and regular ex
commands like `:edit <Tab>` do not require escaping and will continue to
work.

Also fix up documentation to be clearer. The original docs are slightly
misleading in how it discusses triple slashes for 'tags'.

closes: vim/vim#13303
related: vim/vim#13301

54844857fd

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-10 09:15:21 +08:00
zeertzjq
f5eabaa940
fix(path): restore space separation in 'path' (#25571)
Removing this behavior causes more inconsistencies and bugs.
2023-10-10 08:22:32 +08:00
zeertzjq
43f22853fe
docs: fix misplaced mention of 'backupdir' (#25568) 2023-10-10 07:06:34 +08:00
Maria José Solano
c80a3976cb
docs: miscellaneous doc and type fixes (#25554) 2023-10-10 06:34:48 +08:00
Leonardo Mello
81f67b79e8
fix(file_search): path with spaces in finddir() and findfile() (#25493)
Co-authored-by: dundargoc <gocdundar@gmail.com>
2023-10-10 06:08:58 +08:00
zeertzjq
4ab2b43c8f
vim-patch:9.0.2008: test: undofile left behind (#25567)
Problem:  test: undofile left behind
Solution: cleanup undofile

fix: tmp file not deleted when running make test_undo

Temporary file `.Xtestfile.txt.un~` was left running `make test_undo`
and vim was configured with:
```
./configure --with-features=normal --enable-gui=no --enable-terminal
```

closes: vim/vim#13304

b07b9dc4da

Co-authored-by: Dominique Pellé <dominique.pelle@tomtom.com>
2023-10-10 05:56:28 +08:00
dundargoc
40bd96b6f9 ci: use clang 17 as the default clang version is too old 2023-10-09 21:52:56 +02:00
dundargoc
9eb5d9f13f ci: various cleanups
- add reviewers
- correct cache key
2023-10-09 20:27:48 +02:00
dundargoc
6c0f900699 ci: enable clang-analyzer warnings
This adds the checks in https://neovim.io/doc/reports/clang/ when using
clang-tidy. The strategy is to enable all clang-analyzer checks, and
disable only the checks for the warnings that exist currently. This
allows us to eliminate each warning type without blocking ongoing work,
but also without adding bugs for already eliminated warnings.

The plan is to eventually eliminate https://neovim.io/doc/reports/clang/
by completely integrating it into the clang-tidy check.

Also add make and cmake targets `clang-analyzer` to run this check.
2023-10-09 16:52:28 +02:00
Justin M. Keyes
55be4a4e26
fix(coverity): dead code #25562
*** CID 466056:  Control flow issues  (DEADCODE)
    /src/nvim/window.c: 6951 in file_name_in_line()
    6945       // Search backward for first char of the file name.
    6946       // Go one char back to ":" before "//", or to the drive letter before ":\" (even if ":"
    6947       // is not in 'isfname').
    6948       while (ptr > line) {
    6949         if ((len = (size_t)(utf_head_off(line, ptr - 1))) > 0) {
    6950           ptr -= len + 1;
    >>>     CID 466056:  Control flow issues  (DEADCODE)
    >>>     Execution cannot reach the expression "path_has_drive_letter(ptr - 2)" inside this statement: "if (vim_isfilec((uint8_t)pt...".
    6951         } else if (vim_isfilec((uint8_t)ptr[-1])
    6952                    || (len >= 2 && path_has_drive_letter(ptr - 2))
    6953                    || ((options & FNAME_HYP) && path_is_url(ptr - 1))) {
    6954           ptr--;
    6955         } else {
    6956           break;
2023-10-09 06:05:36 -07:00
Christian Clason
307a7abf86 build(deps): bump libmpack-lua to 1.0.11
update vendored libmpack-lua to match

https://github.com/libmpack/libmpack-lua/releases/tag/1.0.11
2023-10-09 12:37:15 +02:00
ii14
139e6f68f9
fix(autocmd): API functions accept garbage after event name #25523
"VimEnter foo" was accepted as a valid event name for "VimEnter".
Events delimited with commas, eg. "VimEnter,BufRead", were also
accepted, even though only the first event was actually parsed.

Co-authored-by: ii14 <ii14@users.noreply.github.com>
2023-10-09 02:50:44 -07:00
dundargoc
8e932480f6 refactor: the long goodbye
long is 32 bits on windows, while it is 64 bits on other architectures.
This makes the type suboptimal for a codebase meant to be
cross-platform. Replace it with more appropriate integer types.
2023-10-09 11:45:46 +02:00
Jaehoon Hwang
dacd34364f
feat(ui-ext): make 'mousehide' into proper ui_option (#25532) 2023-10-09 16:48:24 +08:00
zeertzjq
f96f8566b5
test(ui/embed_spec): use notification instead of request (#25555)
This avoid the hang mentioned in #24888, and also matches TUI better.
2023-10-09 16:14:37 +08:00
Christian Clason
dadc06ced2 build(deps): bump luajit to HEAD - 656ecbcf8 2023-10-09 09:25:26 +02:00
bfredl
61f1e992ce
Merge pull request #25503 from bfredl/unishape
refactor(grid): do arabic shaping in one place
2023-10-08 23:32:24 +02:00
Christian Clason
e5855697e9 vim-patch:1e33cd72b60a
runtime: make command name for &iskeywordprg more unique (vim/vim#13297)

See https://github.com/vim/vim/pull/13213/commits by @dkearns:
Rename 'keywordprg' user command to ShKeywordPrg as this is just a
leaking implementation detail.

1e33cd72b6

Co-authored-by: Enno <Konfekt@users.noreply.github.com>
2023-10-08 23:31:49 +02:00