| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
| |
Problem: We want to deprecate `nvim_err_write(ln)()` but there is no
obvious replacement (from Lua). Meanwhile we already have
`nvim_echo()` with an `opts` argument.
Solution: Add `err` argument to `nvim_echo()` that directly maps to
`:echoerr`.
|
|
|
| |
Result of `make iwyu` (after some "fixups").
|
|
|
|
|
|
|
| |
Problem: Two separate try/end wrappers, that only marginally differ by
restoring a few variables. Wrappers that don't restore
previous state are dangerous to use in "api-fast" functions.
Solution: Remove wrappers that don't restore the previous state.
Always use TRY_WRAP.
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
- API functions using `try_start` directly instead of `TRY_WRAP`, do not
surface the underlying error message, and instead show generic things
like "Failed to set buffer".
- Error handling code is duplicated in the API impl, instead of
delegating to the vim buffer/window handling logic.
Solution:
- Use `TRY_WRAP`.
|
| |
|
|
|
| |
Fix regression from #31195
|
|
|
|
|
|
|
|
| |
Problem: Documentation for "hl_group" in nvim_buf_set_extmark() is
unclear. "hl_group" in nvim_echo() does not accept
highlight group id.
Solution: Move documentation for highlight group name/id to first
mention of hl_group. Update nvim_echo() to accept highlight
group id.
|
|
|
|
|
|
|
| |
Problem: Highlight group id is not propagated to the end of the message call
stack, where ext_messages are emitted.
Solution: Refactor message functions to pass along highlight group id
instead of attr id.
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: too many strlen() calls in register.c
Solution: refactor code, add string_T struct to keep track
of string lengths (John Marriott)
closes: vim/vim#15952
https://github.com/vim/vim/commit/79f6ffd388299ef3b1c95cbe658785e6e66df144
Co-authored-by: John Marriott <basilisk@internode.on.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the api_info() output:
:new|put =map(filter(api_info().functions, '!has_key(v:val,''deprecated_since'')'), 'v:val')
...
{'return_type': 'ArrayOf(Integer, 2)', 'name': 'nvim_win_get_position', 'method': v:true, 'parameters': [['Window', 'window']], 'since': 1}
The `ArrayOf(Integer, 2)` return type didn't break clients when we added
it, which is evidence that clients don't use the `return_type` field,
thus renaming Dictionary => Dict in api_info() is not (in practice)
a breaking change.
|
|
|
|
|
|
|
|
|
|
| |
Problem:
crash when calling nvim_buf_get_text() with a large negative start_col:
call nvim_buf_get_text(0, 0, -123456789, 0, 0, {})
Solution:
clamp start_col after subtracting it from the line length.
|
| |
|
|
|
|
|
|
|
| |
This also makes shada reading slightly faster due to avoiding
some copying and allocation.
Use keysets to drive decoding of msgpack maps for shada entries.
|
|
|
|
|
|
|
|
|
|
|
| |
Before this change, "static inline" functions in headers needed to have
their function attributes specified in a completely different way. The
prototype had to be duplicated, and REAL_FATTR_ had to be used instead
of the public FUNC_ATTR_ names.
TODO: need a check that a "header.h.inline.generated.h" file is not
forgotten when the first "static inline" function with attributes
is added to a header (they would just be silently missing).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a breaking change which will make refactor of typval and shada
code a lot easier. In particular, code that would use or check for
v:msgpack_types.binary in the wild would be broken. This appears to be
rarely used in existing plugins.
Also some cases where v:msgpack_type.string would be used to represent a
binary string of "string" type, we use a BLOB instead, which is
vimscripts native type for binary blobs, and already was used for BIN
formats when necessary.
msgpackdump(msgpackparse(data)) no longer preserves the distinction
of BIN and STR strings. This is very common behavior for
language-specific msgpack bindings. Nvim uses msgpack as a tool to
serialize its data. Nvim is not a tool to bit-perfectly manipulate
arbitrary msgpack data out in the wild.
The changed tests should indicate how behavior changes in various edge
cases.
|
|
|
|
| |
Step towords completely eliminating msgpack_packer.
|
|
|
|
|
|
|
| |
Work towards getting rid of libmsgpack depedency eventually.
msgpack_sbuffer is just a string buffer, we can use our own
String type.
|
| |
|
| |
|
|
|
|
|
|
| |
- Test maparg() and maplist() in the same test.
- Use matches() instead of string.match().
- Avoid overlong lines and strange spacing in exec_lua().
- Revert code change from last PR as the variable may be needed.
|
|
|
| |
Also remove unnecessary variable in API converter.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before, we needed to always pack an entire msgpack_rpc Object to
a continous memory buffer before sending it out to a channel.
But this is generally wasteful. it is better to just flush
whatever is in the buffer and then continue packing to a new buffer.
This is also done for the UI event packer where there are some extra logic
to "finish" of an existing batch of nevents/ncalls. This doesn't really
stop us from flushing the buffer, just that we need to update the state
machine accordingly so the next call to prepare_call() always will
start with a new event (even though the buffer might contain overflow
data from a large event).
|
|
|
|
|
|
|
|
| |
Then we can just load metadata in C as a single msgpack blob. Which also
can be used directly as binarly data, instead of first unpacking all the
functions and ui_events metadata to immediately pack it again, which was
a bit of a silly walk (and one extra usecase of `msgpack_rpc_from_object`
which will get yak shaved in the next PR)
|
|
|
|
|
|
|
|
|
| |
As only a few API functions make use of explicit freeing of the return
value, make it opt-in instead. The arena is always present under the
hood, so `Arena *arena` arg now doesn't mean anything other than getting
access to this arena. Also it is in principle possible to return an
allocated value while still using the arena as scratch space for other
stuff (unlikely, but there no reason to not allow it).
|
| |
|
|
|
|
|
|
| |
Note: kSDItemHeader is something is _written_ by nvim in the shada file
to identify it for debugging purposes outside of nvim. But this data wasn't ever used by
neovim after reading the file back, So I removed the parsing of it for now.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Note: this contains two _temporary_ changes which can be reverted
once the Arena vs no-Arena distinction in API wrappers has been removed.
Both nlua_push_Object and object_to_vim_take_luaref() has been changed
to take the object argument as a pointer. This is not going to be
necessary once these are only used with arena (or not at all) allocated
Objects.
The object_to_vim() variant which leaves luaref untouched might need to
stay for a little longer.
|
|
|
|
|
|
|
|
|
|
|
|
| |
and for return value of nlua_exec/nlua_call_ref, as this uses
the same family of functions.
NB: the handling of luaref:s is a bit of a mess.
add api_luarefs_free_XX functions as a stop-gap as refactoring
luarefs is a can of worms for another PR:s.
as a minor feature/bug-fix, nvim_buf_call and nvim_win_call now preserves
arbitrary return values.
|
| |
|
|
|
|
|
| |
In the context a String inside an Object/Dictionary etc is consumed,
it is considered to be read-only.
|
|
|
|
|
|
|
| |
Implement api_keydict_to_dict as the complement to api_dict_to_keydict
Fix a conversion error when nvim_get_win_config gets called from lua,
where Float values "x" and "y" didn't get converted to lua numbers.
|
| |
|
|
|
|
|
| |
These can either be number or string in lua, so we can specify this
directly as "number|string".
|
| |
|
|
|
|
|
|
| |
Remove `export` pramgas from defs headers as it causes IWYU to believe
that the definitions from the defs headers comes from main header, which
is not what we really want.
|
| |
|
|
|
|
|
| |
"export" only prevents IWYU from adding these headers if the headers
that export them are included, while "private" ensures that IWYU never
adds these headers.
|
|
|
|
| |
Reference: https://github.com/neovim/neovim/issues/6371.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
It isn't really useful to put anonymous enums only used as arguments to
functions calls in _defs.h headers, as they will only be used by a file
that calls those functions, which requires including a non-defs header.
Also move os_msg() and os_errmsg() back to message.h, as on Windows they
are actual functions instead of macros.
Also remove gettext.h and globals.h from private/helpers.h.
|
| |
|
|
|
|
|
| |
Since the parent commit, object_to_vim() can't fail, so callers don't
need to check its result.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
Since e057b38e7037 #20757 we support empty key in JSON encode/decode,
but we don't allow it in RPC object => Vim dict conversion. But empty
string is a valid key in Vim dicts and the msgpack spec.
Empty string key was disallowed in 7c01d5ff9286 (2014) but that
commit/PR doesn't explicitly discuss it, so presumably it was a "seems
reasonable" decision (or Vimscript didn't allow empty keys until later).
Solution:
Remove the check in `object_to_vim()`. Note that
`tv_dict_item_alloc_len` will invoke `memcpy(…, 0)` but that's allowed
by the C spec: https://stackoverflow.com/a/3751937/152142
|
| |
|
|
|
|
|
|
| |
FUNC_ATTR_* should only be used in .c files with generated headers.
Defining FUNC_ATTR_* as empty in headers causes misuses of them to be
silently ignored. Instead don't define them by default, and only define
them as empty after a .c file has included its generated header.
|
| |
|
| |
|