Commit Graph

18933 Commits

Author SHA1 Message Date
Sean Dewar
0eadd7e5fd
vim-patch:8.1.0757: not enough documentation for Blobs
Problem:    Not enough documentation for Blobs.
Solution:   Add a section about Blobs.
d89682477c

Include doc changes for empty() from v7.4.1274.
Include some minor typo fixes.
2021-09-15 22:30:20 +01:00
Sean Dewar
2b98bdd75b
vim-patch:8.1.0756: copy() does not make a copy of a Blob
Problem:    copy() does not make a copy of a Blob.
Solution:   Make a copy.
3d28b58c51

Replace vim_memsave() with xmemdup().
2021-09-15 21:54:00 +01:00
Sean Dewar
c1b8731ece
vim-patch:8.1.0755: error message for get() on a Blob with invalid index
Problem:    Error message for get() on a Blob with invalid index.
Solution:   Return an empty Blob, like get() on a List does.
2ea773b468
2021-09-15 21:54:00 +01:00
Sean Dewar
d346ac536f
vim-patch:8.1.0742: not all Blob operations are tested
Problem:    Not all Blob operations are tested.
Solution:   Add more testing for Blob.
05500ece62

Test_readfile_binary is already ported.
2021-09-15 21:53:38 +01:00
Sean Dewar
7200454ee6
vim-patch:8.1.0738: using freed memory, for loop over blob leaks memory
Problem:    Using freed memory, for loop over blob leaks memory.
Solution:   Clear pointer after freeing memory.  Decrement reference count
            after for loop over blob.
ecc8bc482b
2021-09-15 21:19:31 +01:00
Sean Dewar
de9df825d5
feat(decode_string): decode binary string with NULs to Blob
Strings that previously decoded into a msgpack special for representing
BINs with NULs now convert to Blobs. It shouldn't be possible to decode
into this special anymore after this change?

Notably, Lua strings with NULs now convert to Blobs when passed to VimL.
2021-09-15 21:19:30 +01:00
Sean Dewar
ef729fb15b
feat(shada): restore Blob globals properly
As Strings and Blobs are encoded as msgpack BINs, the current ShaDa
implementation will restore global Blob variables as Strings (or msgpack
special dicts if they contain NULs).

Encode an additional element with Blob globals to differentiate them
from Strings so that we can restore them with the correct type.

Adjust variables_spec.lua's autotest() to also check for proper type.
2021-09-15 21:19:30 +01:00
Sean Dewar
af6f454f5c
feat(msgpack): convert Blobs to BIN strings 2021-09-15 21:19:30 +01:00
Sean Dewar
ab82369c8e
feat(json): convert Blobs to array of byte values
Similiar to how Vim does it, but to be consistent with how Nvim encodes
lists, add a space after every comma.
2021-09-15 21:19:29 +01:00
Sean Dewar
312c783d81
feat(api): convert Blobs to API strings
Note that these are not NUL-terminated; the API supports this.
2021-09-15 21:19:29 +01:00
Sean Dewar
10aa60e806
feat(nlua): convert Blobs to strings 2021-09-15 21:19:29 +01:00
Sean Dewar
bfeecd0b41
vim-patch:8.1.0736: code for Blob not sufficiently tested
Problem:    Code for Blob not sufficiently tested.
Solution:   Add more tests.  Fix uncovered crash.  Add test_null_blob().
c0f5a78c15

eval0 and ex_echo's emsg-specific changes have already been ported.
These tests uncover another crash that was fixed in v8.1.0738.
2021-09-15 21:19:29 +01:00
Sean Dewar
9095101743
vim-patch:8.1.0735: cannot handle binary data
Problem:    Cannot handle binary data.
Solution:   Add the Blob type. (Yasuhiro Matsumoto, closes vim/vim#3638)
6e5ea8d2a9

Nvim-specific Blob conversions are implemented in future commits.

Refactor write_blob() to use a FileDescriptor, as f_writefile() was
refactored to use one (does not apply to read_blob()).

Use var_check_lock() in f_add() for Blobs from v8.1.0897.

Add a modeline to test_blob.vim and fix some doc typos.

Include if_perl.txt's VIM::Blob() documentation. Interestingly, this
function already worked before this port, as it just returns a Blob
string literal, not an actual Blob object.

N/A patches for version.c:

vim-patch:8.1.0741: viminfo with Blob is not tested

Problem:    Viminfo with Blob is not tested.
Solution:   Extend the viminfo test.  Fix reading a blob.  Fixed storing a
            special variable value.
8c8b8bb56c

vim-patch:8.1.1022: may use NULL pointer when out of memory

Problem:    May use NULL pointer when out of memory. (Coverity)
Solution:   Check for blob_alloc() returning NULL.
e142a9467a
2021-09-15 21:19:22 +01:00
Gregory Anders
a5bbb932f9 refactor: move vim.lsp.diagnostic to vim.diagnostic
This generalizes diagnostic handling outside of just the scope of LSP.
LSP clients are now a specific case of a diagnostic producer, but the
diagnostic subsystem is decoupled from the LSP subsystem (or will be,
eventually).

More discussion at [1].

[1]: https://github.com/neovim/neovim/pull/15585
2021-09-15 14:09:47 -06:00
Michael Lingelbach
685cf39813
feat(lsp): improve logging (#15636)
* Simplify rpc encode/decode messages to rpc.send/rcp.receive
* Make missing handlers message throw a warning
* Clean up formatting style in log
* Move all non-RPC loop messages to trace instead of debug
* Add format func option to log to allow newlines in per log entry
2021-09-15 11:35:04 -07:00
Sean Dewar
afdc9e6150
fix(:source): copy curbuf lines to memory before sourcing #15111
It's possible for weirdness to happen if curbuf is modified while
sourcing from it via :source (with no arguments). For example:

- Deleting lines from or wiping curbuf can cause internal error E315 to
  be thrown from ml_get.
- Changing the curbuf to another buffer while sourcing can cause lines
  from the new curbuf to then be sourced instead.
2021-09-15 05:17:07 -07:00
Sean Dewar
6188926e00
fix(:source, nvim_exec): handle Vimscript line continuations #14809
Problem:
Anonymous :source (no args) and nvim_exec() don't support Vimscript line continuations.

Solution:
Factor out the concat logic into concat_continued_line() and a
CONCAT_CONTINUED_LINES macro for simple concatenations where lines are
fetched individually.

Closes #14807
2021-09-14 16:35:33 -07:00
Björn Linse
b86039b104 fix(ui): don't log from UI events during free_all_mem()
Example assertion failure:

   %0 in logmsg neovim/src/nvim/log.c:139:17
   %1 in ui_call_update_menu neovim/build/src/nvim/auto/ui_events_call.generated.h:8:3
   %2 in ex_menu neovim/src/nvim/menu.c:263:3
   %3 in do_one_cmd neovim/src/nvim/ex_docmd.c:1981:5
   %4 in do_cmdline neovim/src/nvim/ex_docmd.c:602:20
   %5 in do_cmdline_cmd neovim/src/nvim/ex_docmd.c:287:10
   %6 in free_all_mem neovim/src/nvim/memory.c:596:3
   %7 in os_exit neovim/src/nvim/main.c:574:3
   %8 in exit_event neovim/src/nvim/msgpack_rpc/channel.c:569:5
2021-09-14 21:01:15 +02:00
Justin M. Keyes
9edd17509f
Merge #15657 vim-patch:8.1.1195,8.2.{3417,3419} 2021-09-14 10:27:21 -07:00
Justin M. Keyes
b63b4777ec
docs: third-party licenses, TEST_COLORS, system() #15665 2021-09-14 10:20:33 -07:00
dundargoc
0a83017fe9
refactor: format files with uncrustify #15663 2021-09-14 09:13:34 -07:00
hrsh7th
516775e9d8
fix(lsp): correctly parse LSP snippets #15579
Fixes #15522
2021-09-14 04:31:41 -07:00
dundargoc
b8cce77702
fix: "redundant cast to the same type" #15662
Apply "redundant cast to the same type" fix from clangd.
2021-09-14 04:07:08 -07:00
dundargoc
6ed43f8f1c
refactor: format tui/input.c with uncrustify (#15661) 2021-09-14 12:21:24 +02:00
dundargoc
0771504488
refactor: format tui.c with uncrustify (#15640) 2021-09-14 10:36:08 +02:00
Sean Dewar
31ac33bf77
vim-patch:8.2.3419: a failing debug expression may make Vim unusable
Problem:    A failing debug expression may make Vim unusable.
Solution:   Suppress error messages. (closes vim/vim#8848)
0325d3967c
2021-09-13 17:24:07 +01:00
Sean Dewar
936c4ae151
vim-patch:8.2.3417: Vim9: a failing debug expression aborts script sourcing
Problem:    Vim9: a failing debug expression aborts script sourcing.
Solution:   Do not let expression failure abort script sourcing. (closes vim/vim#8848)
072f1c6888

Vim9script is N/A, exclude Test_Debugger_breakadd_expr.

Move debuggy struct to before generated header inclusion so
eval_expr_restore prototype works.

Add CheckRunVimInTerminal to Test_Debugger_breakadd.
Cherry-pick Test_Debugger_breakadd changes from v8.2.1440, v8.2.1736.
2021-09-13 17:19:24 +01:00
Sean Dewar
9f3d7dcda2
vim-patch:8.1.1195: Vim script debugger functionality needs cleanup
Problem:    Vim script debugger functionality needs cleanup.
Solution:   Move debugger code to a separate file.  Add more tests. (Yegappan
            Lakshmanan, closes vim/vim#4285)
eead75c5e8

Good to have for eval_expr_restore in v8.2.3417.

Doesn't actually add any tests.
2021-09-13 17:19:15 +01:00
Christian Clason
5fd21b8d3e
vim-patch:6c391a74fe90 (#15654)
Update runtime files
6c391a74fe

omit autoload/getscript.vim

skip doc/eval.txt (needs 8.2.2468)
skip doc/various.txt (needs 8.2.3400)

(typofixes courtesy of @dundargoc)
2021-09-13 16:33:41 +02:00
Christian Clason
1a9d2a4040
vim-patch:89a9c159f23f #15641
Update runtime files
89a9c159f2

Omit:
nsis/lang/turkish.nsi
pixmaps/gen-inline-pixbufs.sh
doc/popup.txt
doc/terminal.txt
tutor/tutor*
src/[g]vimtutor
CONTRIBUTING.md

Skip:
doc/eval.txt (needs 8.1.2342)
doc/testing.txt (needs 8.2.0299)
2021-09-13 06:05:27 -07:00
dundargoc
d5b66e8860
refactor: replace TRUE/FALSE with true/false #15647 2021-09-13 04:57:36 -07:00
Christian Clason
b9d57fa107
vim-patch:8.2.3432: octave/Matlab filetype detection does not work properly (#15652)
Problem:    Octave/Matlab filetype detection does not work properly.
Solution:   Update the patterns used for matching. (Doug Kearns)
ca0627df69
2021-09-13 10:00:09 +02:00
Sean Dewar
643cb8a6ec
doc(options): remove vim9script reference (#15645)
[skip ci]
2021-09-12 13:51:00 +02:00
Christian Clason
5615ea8b6b
vim-patch:8.2.3368: not all Racket files are recognized (#15643)
Problem:    Not all Racket files are recognized.
Solution:   Also recognize .rktl and .rktd files. (Doug Kearns)
9cd91a1e88
2021-09-12 13:09:18 +02:00
Christian Clason
ae73aa8339
vim-patch:8.2.3374: Pyret files are not recognized (#15642)
Problem:    Pyret files are not recognized.
Solution:   Recognize .arr files as Pyret. (Doug Kearns)
eb05d05f8a
2021-09-12 12:55:34 +02:00
Björn Linse
1c5833cb00
Merge pull request #15639 from bfredl/xdata
fix(tests): use isolated XDG_DATA_HOME in startup tests
2021-09-12 11:35:31 +02:00
Christian Clason
229effac9f
vim-patch:partial 6aa57295cfbe (#15633)
* vim-patch:partial 6aa57295cfbe

Update runtime files
6aa57295cf

omit doc/popup.txt
omit plugin/manpager.vim

partial skip runtime/doc/eval.txt (needs 8.2.{0258,0924,1544,2324,2468,2606})

skip ftplugin/julia.vim, indent/julia.vim, syntax/julia.vim (already
        ported in
        65f32f0f19)
skip syntax/scala.vim (already ported in
        a92e83ac14)
2021-09-12 11:02:33 +02:00
Christian Clason
4a7a99ff31
Merge pull request #15550 from jasonccox/vim-8.2.3385
vim-patch:8.2.3385,8.2.3393
2021-09-12 10:55:35 +02:00
Björn Linse
8e663e28ee fix(tests): use isolated XDG_DATA_HOME in startup tests
Otherwise the users site packages will be loaded from ~/.local/share/nvim/site
which can cause unexpected error messages and other kinds of mayhem

Simpler alternative: use "--noplugin". Shouldn't be done because:
(1) these tests should test the ordinary startup code path as close as possible
(2) tests that test the loading of site packages will be added here very soon
2021-09-12 09:30:46 +02:00
Björn Linse
cd4ec810e9
Merge pull request #14770 from andrew-pa/fix13403
Fix relative float positioning
2021-09-12 09:23:47 +02:00
Björn Linse
e2c3bcd52c
Merge pull request #15637 from bfredl/colorsss
fix(build): add an env var to re-enable the colors
2021-09-12 08:34:13 +02:00
Björn Linse
5087347e3b fix(build): add an env var to re-enable the colors 2021-09-11 23:20:00 +02:00
Justin M. Keyes
413e86869e
Merge #14611 from seandewar/vim-8.1.1116
vim-patch:8.1.{1116,1188,1190,1355,1722,2035,2036,2038,2043},8.2.{0886,2309}
2021-09-11 12:12:59 -07:00
Christian Clason
e31652879e
vim-patch:partial 53f7fccc9413 (#15631)
* vim-patch:partial 53f7fccc9413

Update runtime files
53f7fccc94

omit macros/hanoi/hanoi.vim
omit spell/tet/main.aap
omit tools/shtags.1
omit tools/xcmdsrv_client.c

skip doc/pattern.txt (requires 8.2.3110; 8.2.{1665,1872})
skip doc/map.txt (requires 8.2.3228)
2021-09-11 16:47:45 +02:00
Sean Dewar
7175efb518
fix(get_showbreak_value): remove FUNC_ATTR_UNUSED 2021-09-11 15:36:04 +01:00
Sean Dewar
26733dd488
vim-patch:8.2.2309: 0o777 not recognized as octal
Problem:    0o777 not recognized as octal.
Solution:   Use vim_isodigit(). (Ken Takata, closes vim/vim#7633, closes vim/vim#7631)
c37b655443

:scriptversion is N/A.
2021-09-11 15:36:04 +01:00
Sean Dewar
90a4cf92d2
vim-patch:8.2.0886: cannot use octal numbers in scriptversion 4
Problem:    Cannot use octal numbers in scriptversion 4.
Solution:   Add the "0o" notation. (Ken Takata, closes vim/vim#5304)
c17e66c5c0

:scriptversion is N/A.

Cherry-pick latest str2nr() doc changes from v8.1.2035.
Cherry-pick various mentions of the 0o prefix from:
 - v8.2.2324
 - 2346a63784
 - 11e3c5ba82
 - 82be4849ee

Patch used ascii_isbdigit() by mistake, which was fixed in v8.2.2309.

Make STR2NR_OOCT work the same as STR2NR_OCT when forcing.
In Vim, STR2NR_FORCE | STR2NR_OOCT isn't handled, and doesn't actually
force anything. Rather than abort(), make it work as STR2NR_OCT.

This means STR2NR_FORCE | STR2NR_OCT works the same as
STR2NR_FORCE | STR2NR_OOCT and STR2NR_FORCE | STR2NR_OCT | STR2NR_OOCT.
2021-09-11 15:36:03 +01:00
Sean Dewar
10018958d8
vim-patch:8.1.2043: not sufficient testing for quoted numbers
Problem:    Not sufficient testing for quoted numbers.
Solution:   Add a few more test cases.
ea8dcf8346

:scriptversion is N/A.

Already added more quote tests in the port of v8.1.2036.
2021-09-11 15:35:55 +01:00
Sean Dewar
b6d9e92805
vim-patch:8.1.2036: the str2nr() tests fail
Problem:    The str2nr() tests fail.
Solution:   Add missing part of patch.
1ac90b4fa6

Add extra tests for quoted numbers in vim_str2nr_spec.lua, as the
included ones in this patch are somewhat lacking.
2021-09-11 15:33:20 +01:00
Sean Dewar
6617629ad6
vim-patch:8.1.2035: recognizing octal numbers is confusing
Problem:    Recognizing octal numbers is confusing.
Solution:   Introduce scriptversion 4: do not use octal and allow for single
            quote inside numbers.
60a8de28d1

:scriptversion is N/A.

Cherry-pick Test_readfile_binary() from v8.1.0742.

Note that this patch was missing vim_str2nr() changes, and so fails the
tests; this was fixed in v8.1.2036.
2021-09-11 15:33:20 +01:00