Reasoning; currently INTERNAL_CALL is mostly used to determine whether it is
needed to deal with NL-used-as-NUL problem. This code is useful for nvim_… API
calls done from VimL, but not for API calls done from lua, yet lua needs to
supply something as channel_id.
During testing found the following bugs:
1. msgpack-gen.lua script is completely unprepared for Float values either in
return type or in arguments. Specifically:
1. At the time of writing relevant code FLOAT_OBJ did not exist as well as
FLOATING_OBJ, but it would be used by msgpack-gen.lua should return type
be Float. I added FLOATING_OBJ macros later because did not know that
msgpack-gen.lua uses these _OBJ macros, otherwise it would be FLOAT_OBJ.
2. msgpack-gen.lua should use .data.floating in place of .data.float. But it
did not expect that .data subattribute may have name different from
lowercased type name.
2. vim_replace_termcodes returned its argument as-is if it receives an empty
string (as well as _vim_id*() functions did). But if something in returned
argument lives in an allocated memory such action will cause double free:
once when freeing arguments, then when freeing return value. It did not cause
problems yet because msgpack bindings return empty string as {NULL, 0} and
nothing was actually allocated.
3. New code in msgpack-gen.lua popped arguments in reversed order, making lua
bindings’ signatures be different from API ones.
No tests yet, no documentation update, no :lua* stuff, no vim module.
converter.c should also work with typval_T, not Object.
Known problem: luaeval("1", {}) results in
PANIC: unprotected error in call to Lua API (attempt to index a nil value)
Ref #3823
It's important that users have a single, easy-to-remember place for
reading about the API. So this commit changes gen_api_vimdoc.py so that
the generated section is appended to api.txt instead of creating
a separate document.
Also remove the section numbering and ToC: it's a maintenance cost, and
it will be unnecessary when #5169 is integrated.
It's not atypical to have extra, non-"vim-patch" commits in a PR merging
a bigger or set of related patches from Vim. Rather than immediately
aborting, display the patch header to the user and let them decide
whether to continue reviewing.
grep 2.26 changed its behavior when redirecting its output to /dev/null
such that it exits as soon as one match is found. This causes sed to
get a SIGPIPE which, due to "set -o pipefail", falsely implies that the
patch is not applied.
Removing "set -o pipefail" preserves the good exit status from grep.
Since data.integer is a different (larger) integer type than
data.{buffer,window,tabpage}, we cannot abuse the union by using
data.integer to access the value for all 4 types. Instead, remove the
{buffer,window,tabpage} members and always use the integer member.
In order to accomodate this, perform distinct validation and coercion
between the Integer type and Buffer/Window/Tabpage types in
object_to_vim, msgpack_rpc helpers, and gendispatch.lua.
FEATURES:
0b5a7e4ad5#4432 API: external UIs can render custom popupmenu
c6ac4f84b1#4934 API: call any API method from vimscript
31df051ed9#4568 API: nvim_call_atomic(): multiple calls in a single request
b268ba353a#5424 API: nvim_win_get_number(), nvim_tabpage_get_number()
e7e2844d46 has("nvim-1.2.3") checks for a specific Nvim version
522b885a0d#5295, #5493 `:CheckHealth` checks tmux, terminfo, performance
719dae2e01#5384 events: allow event processing in getchar()
f25797f869#5386 API: metadata: Nvim version & API level
22dfe6925d#5389 API: metadata: "since", "deprecated_since"
605e74327a Added QuickFixLine highlight group
CHANGES:
4af6ec746c#5253 perf: Disable clipboard in do_cmdline()
6e9f329d05#5299 perf: Skip foldUpdate() in insert-mode.
9d4fcec7c6#5426 perf: Do not auto-update folds for some foldmethods.
eeec0cab58#5419 tui: Default to normal-mode cursor shape.
FIXES:
e83845285c#5436 tui: Fix "weird characters" / "bleeding termcodes"
10a54ad12e#5243 signal_init: Always unblock SIGCHLD.
bccb49bedb#5316 eval.c: Fix memory leak for detached pty job
626065d385#5227 tchdir: New tab should inherit CWD.
cd321b7d0f#5292 getcwd(): Return empty string if CWD is invalid.
6127eaef05 shada: Fix non-writeable ShaDa directory handling
ca65514a24#2789 system(): Respect shellxescape, shellxquote
2daf54ee8d#4874 Restore vim-like tab dragging
0c536b5d8a#5319 syntax.c: Support bg/fg special color-names.
3c53371b0c#4972 from justinmk/schedule-ui_refresh
68bcb32ec4#4789 tui.c: Do not wait for tui loop on teardown.
c8b6ec2e6a#5409 v:count broken in command-line window
6bc3bcefc6#5461 fix emoji display
51937e1322#5470 fix :terminal with :argadd, :argu
79d77da8a0#5481 external UIs: opening multiple files from command-line
657ba62a84#5501 rplugin: resolve paths in manifest file
6a6f188d2a#5502 system('foo &', 'bar'): Show error, don't crash.
1ff162c0d9#5515 os_nodetype: open fd with O_NONBLOCK
2a6c5bb0c4#5450 modeline: Handle version number overflow.
0ade1bb706#5225 CI tests now run against Windows!
The API level is disconnected from the NVIM version. The API metadata
holds the current API level, and the lowest backwards-compatible level
supported by this instance.
Release 0.1.6 will be the first release reporting the Nvim version and
API level.
metadata['version'] = {
major: 0,
minor: 1,
patch: 6,
prerelease: true,
api_level: 1,
api_compatible: 0,
}
The API level may remain unchanged across Neovim releases if the API has
not changed.
When changing the API the CMake variable NVIM_API_PRERELEASE is set to
true, and NVIM_API_CURRENT/NVIM_API_COMPATIBILITY are incremented
accordingly.
The functional tests check the API table against fixtures of past
versions of Neovim. It compares all the functions in the old table with
the new one, it does ignore some metadata attributes that do not alter
the function signature or were removed since 0.1.5. Currently the only
fixture is 0.mpack, generated from Neovim 0.1.5 with nvim --api-info.
Let genunicodetables determine which files it needs from the unicode
directory. cmake just needs to pass the directory and destination file
to the script.
Problem: Handling emoji characters as full width has problems with
backwards compatibility.
Solution: Only put characters in the 1f000 range in the emoji table.
6a08454b93
Problem: Handling emoji characters as full width has problems with
backwards compatibility.
Solution: Remove ambiguous and double width characters from the emoji table.
Use a separate table for the character class.
(partly by Yashuhiro Matsumoto)
b86f10ee10
Problem: Emoji characters are not considered as a kind of word character.
Solution: Give emoji characters a word class number. (Yashuhiro Matsumoto)
4077b33a83
Problem: Although emoji characters are ambiguous width, best is to treat
them as full width.
Solution: Update the Unicode character tables. Add the 'emoji' options.
(Yasuhiro Matsumoto)
3848e00e01
Without the groupings, only the first alternation matches the diff
marker. For example,
local na_doc='todo\.txt\|version\d\.txt\|tags'
... +'g^diff --git a/runtime/doc/'${na_doc}'...
becomes, after expansion,
... +'g^diff --git a/runtime/doc/todo\.txt\|version\d\.txt\|tags'...
so the matches become "^diff --get a/runtime/doc/todo\.txt",
"version\d\.txt", or "tags". Adding the grouping ensures the expected
behavior of requiring "^diff --get a/runtime/doc/" before every
filename.
Left over change from acb7c82 (fix leak when a api function is
incorrectly called with a list.). These initializations are now never
used and causes warnings in static analysis
Problems:
- Disables cross-compiling (alternative: keeps two hash implementations which
need to be synchronized with each other).
- Puts code-specific name literals into CMakeLists.txt.
- Workaround for lua’s absence of bidirectional pipe communication is rather
ugly.
Removes all kinds of problems with sorting, provides a ready-to-use function
list representation for genvimvim.lua, does not require specifying function name
twice (VimL function name (string) + f_ function name).
Without this the "cd scripts/.." might change to another dir (since
CDPATH is looked at before a local path), and then NEOVIM_SOURCE_DIR
might end up being "/somewhere/else\n/somewhere/else" (since the "cd"
prints the dir already in that case).
Closes https://github.com/neovim/neovim/pull/5213.
It is a wrong thing to do, this makes valid variable values be treated
incorrectly: in
XDG_DATA_HOME='/home/$foo/.local/share'
`$foo` should be treated literally and not expanded to `foo` environment
variable value.
Also makes option_expand not try to expand too long strings even if these too
long strings are default values. Previously it thought that default values
should always be expanded. Also does not try to expand NULL should it be the
default value just in case.
Fixes#4961
If a user has multiple remotes set for neovim/neovim, then
find_get_remote was returning 'remote1\nremote2\n', which breaks
anything trying to use it. Since we're just using this remote to fetch
from, any one will do.
It's acceptable for “git describe --tags --exact-match …” to fail, since
all runtime updates commits are untagged. All that matters is that we
get a tag when one exists.
Therefore, ignore the failure status of the git describe call, relying
on the captured output instead.
There are a total of 5 shell scripts in the Neovim source tree.
All but runtime\macros\less.sh had warnings/errors when run through
Shellcheck (http://www.shellcheck.net/).
This commit fixes all warnings/errors and also changes the shebang to
"#!/bin/sh" when possible (this was not possible for vim-patch.sh
because it uses many bashisms).
The shellcheck errors that were fixed are:
SC2068: Double quote array expansions to avoid re-splitting elements.
SC2086: Double quote to prevent globbing and word splitting.
SC2124: Assigning an array to a string! Assign as array, or use *
instead of @ to concatenate
SC2155: Declare and assign separately to avoid masking return values.
Make get_vim_sources fetch the whole repository (it's not THAT big) so we can
pick up all the patches. The regexp didn't pick up the NA patches if there was a
comma after NA, so I extended it (I allowed arbitray things after NA, so maybe
someone can write a comment or so, should not lead to confusion).
* Calling "vim-patch.sh -p" on a checked-out branch already created with
"-p" will re-use the branch and append commits.
* Fetch upstream/master before checking out branch on first call of "-p".
* Reverted creation of commit in submit step ("-s") to previous behavior:
Create an empty commit with correct commit message when "-p" is called.
* Submitting a pull request with "-s" will create a correct pull request
message even if multiple patches have been ported in one single branch
with "-p".
When calling "vim-patch.sh -s" on a checked-out branch created with
"vim-patch.sh -p", create commit from staged changes, push to origin,
create pull request (using hub), and clean up patch files.
This will avoid confusion if additional `it()` blocks are added.
(`setup()` only runs once per `describe()` block, whereas `before_each()`
runs before each `it()`).
Any patch may contain mixed encodings, so we must process them as byte
arrays. E.g. with stock `sed` on OS X patch
8a94d873aa8c753a8522ea86a049bdf2abd0c507 causes this error:
sed: RE error: illegal byte sequence
To avoid that, set LC_ALL=C.
Also remove redundant *.patch creation from review_pr().
What works:
1. ShaDa file dumping: header, registers, jump list, history, search patterns,
substitute strings, variables.
2. ShaDa file reading: registers, global marks, variables.
Most was not tested.
TODO:
1. Merging.
2. Reading history, local marks, jump and buffer lists.
3. Documentation update.
4. Converting some data from &encoding.
5. Safer variant of dumping viminfo (dump to temporary file then rename).
6. Removing old viminfo code (currently masked with `#if 0` in a ShaDa file for
reference).
API functions exposed via msgpack-rpc now fall into two categories:
- async functions, which are executed as soon as the request is parsed
- sync functions, which are invoked in nvim main loop when processing the
`K_EVENT special key
Only a few functions which can be safely executed in any context are marked as
async.
* Link to the commit details on GitHub for a tagged version.
* Non-tagged patches (runtime updates) are still linked to
Google Code because they are identified by a Mercurial commit hash.
Fixes the handling of the initial input lines of a test script by simply
skipping all initial empty lines.
Helped-by: Florian Walch <florian@fwalch.com>
Suggested-by: Florian Walch <florian@fwalch.com>
Add check to see if a string contains ], which can result in
cases where wrapping a string in [[...]] breaks. Use [=[...]=] instead
on those strings.
Use [=[...]=] for insert() and expect().
- Check for mercurial before using it
- Make 'Merging patches...' wiki page easier to copy
- Use `basename` instead of assuming the user is running vim-patch.sh
via the repo root
- Appease shellcheck by quoting path variables
- Remove unneeded variable quoting inside [[ ]] blocks
- Don't unconditionally 'exit 1'
'-h' and '--help' are both recognized options, so current behavior is
misleading.
* Remove 'test' prefix from test names.
* Ask if existing spec files should be overwritten.
* Fix for legacy tests with no initial buffer content (e.g. test_signs).
- Call compiler from CMake instead of lua script to generate a
preprocessor file - allows for better/early error detection if
the compiler fails
- Preprocessor files are saved along with the headers as .i files
- Accept preprocessor lines with trailing chars after # as is
the case in Clang/Windows
- The fourth argument to gendeclarations.lua is now the path to
the proprocessor output file
- Expose more logging control from the log.c module(get log stream and omit
newlines)
- Remove logging from the generated functions in msgpack-gen.lua
- Refactor channel.c/helpers.c to log every msgpack-rpc payload using
msgpack_object_print(a helper function from msgpack.h)
- Remove the api_stringify function, it was only useful for logging msgpack-rpc
which is now handled by msgpack_object_print.
Since all API functions now run immediately after a msgpack-rpc request is
parsed by libuv callbacks, a mechanism was added to override this behavior and
allow certain functions to run in Nvim main loop.
The mechanism is simple: Any API function tagged with the FUNC_ATTR_DEFERRED (a
"dummy" attribute only used by msgpack-gen.lua) will be called when Nvim main
loop receives a K_EVENT key.
To implement this mechanism it was necessary some restructuration on the
msgpack-rpc modules, especially in the msgpack-gen.lua script.
Now that the lua client is available, python/lupa are no longer necessary to run
the functional tests. The helper functions previously defined in
run-functional-tests.py were adapted to test/functional/helpers.lua.
The 'lupa' python package provides a simple way to seamless integrate lua and
python code.
This commit replaces vroom by a python script that exposes the 'neovim' package
to a lua state, and invokes busted to run functional tests. This is a temporary
solution that will enable writing functional tests using lua/bused while a lua
client library is not available.
The reason for dropping vroom is flexibility: Lua/busted has a nice DSL-style
syntax while also providing the customization power of a full programming
language. Another reason is to use a single framework for unit/functional tests.
Two other changes were performed in this commit:
- Instead of "gcc-unittest/gcc-ia32", the travis builds for gcc are now
identified by "gcc/gcc-32". They will run unit/functional tests for both 64
and 32 bits.
- Old integration tests(in src/nvim/testdir) are now ran by the 'oldtest' target
Adapt gendeclarations.lua/msgpack-gen.lua to allow the `ArrayOf(...)` and
`DictionaryOf(...)` types in function headers. These are simple macros that
expand to Array and Dictionary respectively, but the information is kept in the
metadata object, which is useful for building clients in statically typed
languages.
Instead of building all metadata from msgpack-gen.lua, we now merge the
generated part with manual information(such as types and features). The metadata
is accessible through the api method `vim_get_api_info`.
This was done to simplify the generator while also increasing flexibility(by
being able to add more metadata)
Enhance msgpack-gen.lua to extract custom api type codes from the ObjectType
enum in api/private/defs.h. The type information is made available from the api
metadata and clients can use to correctly serialize/deserialize these types
using msgpack EXT type.
A new method is now exposed via msgpack-rpc: "get_api_metadata". This method has
the same job as the old method '0', it returns an object with API metadata for
use by generators.
There's one difference in the return value though: instead of returning a
string containing another serialized msgpack document, the metadata object is
returned directly(a separate deserialization step by clients is not required).