Commit Graph

22860 Commits

Author SHA1 Message Date
Lewis Russell
99f8d34c8a
Merge pull request #19934 from lewis6991/prepostincr 2022-08-25 14:30:12 +01:00
zeertzjq
cd2d3aa48f
vim-patch:9.0.0261: bufload() reads a file even if the name is not a file name (#19944)
Problem:    bufload() reads a file even if the name is not a file name. (Cyker
            Way)
Solution:   Do not read the file when the buffer name is not a file name.
            (closes vim/vim#10975)
2eddbacd6d
2022-08-25 20:23:29 +08:00
Lewis Russell
93f24403f8 refactor: pre-incr to post-incr 2022-08-25 13:10:41 +01:00
zeertzjq
1b29288709
vim-patch:8.2.4356: command line completion functions are very long (#19943)
Problem:    Command line completion functions are very long.
Solution:   Refactor into multiple functions. (Yegappan Lakshmanan,
            closes vim/vim#9753)
620d8edba0

Change fifth argument of set_context_by_cmdname() to "context".
2022-08-25 19:06:26 +08:00
zeertzjq
274e1122ad
fix(usercmd): also check for whitespace after escaped character (#19942) 2022-08-25 17:57:32 +08:00
zeertzjq
f0658fd552
refactor: suppress clang and PVS warnings (#19940) 2022-08-25 15:20:54 +08:00
Christian Clason
5c9baa6f35
docs(contributing): add documenting guidelines from wiki (#19924)
Co-authored-by: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
2022-08-25 09:06:37 +02:00
zeertzjq
170617c7a2
Merge pull request #19939 from zeertzjq/vim-8.2.4289
vim-patch: compiler warnings
2022-08-25 13:41:17 +08:00
zeertzjq
6584f3a2b6 vim-patch:8.2.4289: warnings reported by MSVC
Problem:    Warnings reported by MSVC.
Solution:   Rename variables and other fixes. (Ken Takata, closes vim/vim#9689)
5411910c77

N/A patches for version.c:

vim-patch:8.2.0091: compiler warnings for size_t / int types

Problem:    Compiler warnings for size_t / int types.
Solution:   Change type to size_t. (Mike Williams)
4d7a248b64

vim-patch:8.2.1299: compiler warning for using size_t for int and void pointer

Problem:    Compiler warning for using size_t for int and void pointer.
Solution:   Add type casts.
d3bb6a82a5

vim-patch:8.2.1906: warning for signed/unsigned

Problem:    Warning for signed/unsigned.
Solution:   Use size_t instead of int. (Mike Williams)
a360dbe3b6

vim-patch:8.2.4531: LGTM warnings for condition and buffer size

Problem:    LGTM warnings for condition always true and buffer size too small.
Solution:   Remove the useless condition.  Make the buffer larger. (Goc
            Dundar, closes vim/vim#9914)
f01a653ac5

vim-patch:8.2.4624: old Coverity warning for resource leak

Problem:    Old Coverity warning for resource leak.
Solution:   Close the file if memory allocation fails.
5d46dcfeed

vim-patch:9.0.0129: compiler warning for int/size_t usage

Problem:    Compiler warning for int/size_t usage.
Solution:   Add a type cast. (Mike Williams, closes vim/vim#10830)
ab146dac6b
2022-08-25 13:18:49 +08:00
zeertzjq
e7dd65eea3 vim-patch:8.2.2826: compiler warnings for int to size_t conversion
Problem:    Compiler warnings for int to size_t conversion. (Randall W.
            Morris)
Solution:   Add type casts.
551c1aed65

Still keep it size_t, but avoid calculating multiple times.
2022-08-25 13:06:33 +08:00
zeertzjq
7656cd527b vim-patch:8.2.1960: warning for uninitialized variable
Problem:    Warning for uninitialized variable.
Solution:   Initialize the variable.
0fd797eacd
2022-08-25 13:02:01 +08:00
zeertzjq
88738bd28f vim-patch:8.2.1728: compiler warning for using uninitialized variable
Problem:    Compiler warning for using uninitialized variable. (John Marriott)
Solution:   Initialize "neighbor".
c53e9c57a9
2022-08-25 12:58:36 +08:00
zeertzjq
711635872d vim-patch:8.1.1085: compiler warning for possibly uninitialized variable
Problem:    Compiler warning for possibly uninitialized variable. (Tony
            Mechelynck)
Solution:   Make conditions more logical.
bd9bf266fc
2022-08-25 12:53:34 +08:00
zeertzjq
e4e0e8ce6f
refactor: ins_compl_show_pum() (#19938)
This marks the remaining part of Vim patch 8.2.3953 as ported, because
ins_compl_upd_pum() has been removed.

vim-patch:8.2.3953: insert completion code is too complicated

Problem:    Insert completion code is too complicated.
Solution:   More refactoring.  Move function arguments into a struct.
            (Yegappan Lakshmanan, closes vim/vim#9437)
6ad84ab3e4
2022-08-25 12:07:49 +08:00
zeertzjq
ee02141c7b
Merge pull request #19937 from zeertzjq/vim-8.2.3942
vim-patch:8.2.{3942,partial:4001}
2022-08-25 11:17:29 +08:00
zeertzjq
b1833bb33b vim-patch:partial:8.2.4001: insert complete code uses global variables
Problem:    Insert complete code uses global variables.
Solution:   Make variables local to the file and use accessor functions.
            (Yegappan Lakshmanan, closes vim/vim#9470)
d94fbfc74a

Skip changes in comments for callback-related functions (not ported).
Also make compl_busy static again.
2022-08-25 10:15:07 +08:00
zeertzjq
45d09b46ce vim-patch:8.2.3942: Coverity reports a possible memory leak
Problem:    Coverity reports a possible memory leak.
Solution:   Free the array if allocation fails.
8e7cc6b920
2022-08-25 10:15:07 +08:00
zeertzjq
674d3b2d5f
Merge pull request #19936 from zeertzjq/vim-8.2.3989
vim-patch:8.2.{2534,3989,4037}: Insert mode completion tests and fixes
2022-08-25 08:54:03 +08:00
zeertzjq
3290e472c0 vim-patch:8.2.4037: Insert mode completion is insufficiently tested
Problem:    Insert mode completion is insufficiently tested.
Solution:   Add more tests.  Fix uncovered memory leak. (Yegappan Lakshmanan,
            closes vim/vim#9489)
370791465e
2022-08-25 08:27:44 +08:00
zeertzjq
cabc1861c4 vim-patch:8.2.3989: some insert completion code is not tested
Problem:    Some insert completion code is not tested.
Solution:   Add a few tests.  Refactor thesaurus completion. (Yegappan
            Lakshmanan, closes vim/vim#9460)
e982586f8e

vim-patch:9.0.0254: typo in function name

Problem:    Typo in function name.
Solution:   Rename the function. (closes vim/vim#10971)
5fb3aabc2b
2022-08-25 08:27:44 +08:00
zeertzjq
6c9a91bebe vim-patch:8.2.2534: missing test coverage
Problem:    Missing test coverage.
Solution:   Improve test coverage for completion with different encodings,
            mapset(), and term function failures. (Dominique Pellé,
            closes vim/vim#7877)
a1070eae77

Cherry-pick E716 -> E715 change from patch 8.2.4861.
2022-08-25 08:27:43 +08:00
zeertzjq
6d8b64fffc
Merge pull request #19927 from zeertzjq/vim-9.0.0045
vim-patch:9.0.{0045,0046,0060,0102}: Insert mode completion crash fixes
2022-08-25 07:17:52 +08:00
zeertzjq
dd77a00621 vim-patch:9.0.0102: reading past end of line with insert mode completion
Problem:    Reading past end of line with insert mode completion.
Solution:   Check text length.
a6f9e30016
2022-08-25 06:53:59 +08:00
zeertzjq
6680002169 vim-patch:9.0.0060: accessing uninitialized memory when completing long line
Problem:    Accessing uninitialized memory when completing long line.
Solution:   Terminate string with NUL.
b9e717367c
2022-08-25 06:53:59 +08:00
zeertzjq
5d1f0c3eca vim-patch:9.0.0046: reading past end of completion with duplicate match
Problem:    Reading past end of completion with duplicate match.
Solution:   Check string length
baefde1455
2022-08-25 06:53:59 +08:00
zeertzjq
c366a63e4c vim-patch:9.0.0045: reading past end of completion with a long line
Problem:    Reading past end of completion with a long line and 'infercase'
            set.
Solution:   Allocate the string if needed.
caea66442d

Cherry-pick the deletion of a blank line from patch 9.0.0027.

N/A patches for version.c:

vim-patch:9.0.0054: compiler warning for size_t to int conversion

Problem:    Compiler warning for size_t to int conversion.
Solution:   Add type cast. (Mike Williams, closes vim/vim#10741)
c7bd2f08e5
2022-08-25 06:53:59 +08:00
Christian Clason
d3cd79709b
vim-patch:fd999452adaf (#19929)
Update runtime files
fd999452ad
2022-08-25 00:49:33 +02:00
zeertzjq
6b9ff5491d
fix(treesitter): free memory on removing parser (#19933)
This fixes the ASAN failure.
2022-08-25 06:41:04 +08:00
bfredl
c545d514df
Merge pull request #19830 from lewis6991/hlgroup_name
feat(highlight)!: error on invalid names and allow '.' and '@'
2022-08-24 21:08:21 +02:00
Thomas Vigouroux
3b2121cedf
Merge pull request #19928 from vigoux/ts-fix-c-parser
test(treesitter): make internal lang test pending when necessary
2022-08-24 19:05:58 +02:00
Lewis Russell
61be343ec8 feat(highlight)!: error on invalid names and allow '.' and '@'
Previously if a highlight group with a name outside the regexp
[a-zA-Z0-9_] was defined, Nvim would emit an "invalid character"
warning message. This was annoying for Lua scripts, as it was very hard
to debug what line of code was triggering this message since it didn't
produce a stack trace.

This has now been promoted to an error with the code E5248.

Additionally the ASCII character period ('.') and at-sign ('@') have
been added to the allowed list of characters of a highlight group name
to support the application of defining hierarchical highlight groups,
e.g. 'TS.keyword'.

Co-authored-by: Christian Clason <christian.clason@uni-due.de>
2022-08-24 17:13:18 +01:00
Thomas Vigouroux
26ebf67c39
test(treesitter): make internal lang test pending when necessary 2022-08-24 16:59:13 +02:00
Lewis Russell
b1eaa2b9a3
feat(lua): add vim.iconv (#18286)
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2022-08-24 14:41:31 +01:00
Thomas Vigouroux
9be4bfc5f4
Merge pull request #19496 from vigoux/ts_internal_lang
feat(treesitter): allow customizing language symbol name
2022-08-24 15:36:58 +02:00
bfredl
f1ea126a6e
Merge pull request #19906 from bfredl/bigstage
perf(api): allow to use an arena for return values
2022-08-24 15:22:30 +02:00
zeertzjq
f91b1885dd
feat(eval)!: make Vim functions return inner window width and height (#19743)
In non-multigrid UI the only change is that the returned height now
excludes winbar, and this is compatible with Vim.

In multigrid UI this means the return value of these functions now
reflect the space available for buffer lines in a window.

No change in nvim_win_get_height() and nvim_win_get_width().
2022-08-24 21:02:45 +08:00
zeertzjq
b0fdce55d0
vim-patch:partial:8.2.3953: insert completion code is too complicated (#19923)
Problem:    Insert completion code is too complicated.
Solution:   More refactoring.  Move function arguments into a struct.
            (Yegappan Lakshmanan, closes vim/vim#9437)
6ad84ab3e4

Skip most pum-related refactoring.
Cherry-pick rename to match_at_original_text() from patch 8.2.4001.
2022-08-24 20:36:10 +08:00
bfredl
7784dc9e0d refactor(api): provide a temporary copy solution for nvim_call_atomic
Make the copy_object() family accept an optional arena. More than
half of the callsites should be refactored to use an arena later
anyway.
2022-08-24 14:22:26 +02:00
bfredl
bcf5ee328e refactor(arena): use a shared block freelist
This is both simpler in client code and more effective (always reuse
block hottest in cache)
2022-08-24 14:22:26 +02:00
zeertzjq
b0569f5813
vim-patch:9.0.0020: with some completion reading past end of string (#19922)
Problem:    With some completion reading past end of string.
Solution:   Check the length of the string.
f12129f171
2022-08-24 16:59:03 +08:00
zeertzjq
79f32c20f0
Merge pull request #19921 from zeertzjq/vim-8.2.3937
vim-patch:8.2.{3937,3944}: Insert mode completion refactoring
2022-08-24 16:12:15 +08:00
zeertzjq
9ac44c7f5d vim-patch:8.2.3944: insert mode completion functions are too long
Problem:    Insert mode completion functions are too long.
Solution:   Split up into multiple functions. (Yegappan Lakshmanan,
            closes vim/vim#9431)
5d2e007ccb

Cherry-pick can_cindent_get() -> get_can_cindent() from patch 8.1.2062.
2022-08-24 15:47:15 +08:00
zeertzjq
ef748af01d vim-patch:8.2.3937: Insert mode completion function is too long
Problem:    Insert mode completion function is too long.
Solution:   Refactor into multiple functions. (Yegappan Lakshmanan,
            closes vim/vim#9423)
edc6f10390

Cherry-pick a typo fix from patch 8.2.3637.
2022-08-24 15:47:14 +08:00
sigmaSd
a4e4609d62
fix(path): path_is_url returns false for "foo:/" #19797
Problem:
path_to_url() returns false for single-slash URIs ("foo:/" vs "foo://").
This is not compliant with the URI spec. https://url.spec.whatwg.org/#url-representation
LSP in particular allows single-slash URIs.

Solution:
Relax path_to_url() to accept single-slash URIs. This is not fully
compliant (only ":" is required by the spec), but it is hopefully good
enough without causing false-positives in typical text files.

ref https://url.spec.whatwg.org/#windows-drive-letter
ref https://github.com/neovim/neovim/pull/19773
ref https://github.com/neovim/neovim/pull/19773#issuecomment-1214763769
2022-08-23 23:38:06 -07:00
zeertzjq
9a100ee169
fix(cmdline): do not trigger completion at wrong time (#19920)
Cherry-picked from Vim patches 8.2.4339, 9.0.0238.
2022-08-24 10:28:32 +08:00
zeertzjq
64d147b471
vim-patch:9.0.0248: duplicate code in finding a script in the execution stack (#19917)
Problem:    Duplicate code in finding a script in the execution stack.
Solution:   Reduce duplicate code. (closes vim/vim#10961)
a247142ae4
2022-08-24 06:28:37 +08:00
bfredl
c0d6052654 perf(api): allow to use an arena for return values 2022-08-23 18:34:24 +02:00
zeertzjq
6cc6e11929
vim-patch:9.0.0206: redraw flags are not named specifically (#19913)
Problem:    Redraw flags are not named specifically.
Solution:   Prefix "UPD_" to the flags, for UPDate_screen().
a4d158b3c8
2022-08-23 22:00:19 +08:00
Lewis Russell
779a25f040
refactor(spell.c): resolve clint errors (#19875)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-08-23 14:30:02 +01:00
Lewis Russell
0c0a426e40
doc(CONTRIBUTING): update #19891
- add section for managing includes via IWYU
- recommend clangd over ctags
- tidy up links
- remove ./scripts/check-includes.py
2022-08-23 06:18:05 -07:00