aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/private/helpers.c
Commit message (Collapse)AuthorAge
...
* vim-patch:8.0.0607 (#6879)Daniel Hahler2017-06-11
| | | | | | | | Problem: When creating a bufref, then using :bwipe and :new it might get the same memory and bufref_valid() returns true. Solution: Add br_fnum to check the buffer number didn't change. https://github.com/vim/vim/commit/45e5fd135da5710f24a1acc142692f120f8b0b78
* get_keymap API (#6236)TJ DeVries2017-05-25
| | | | | | | * Add api function get keymap nvim_get_keymap(mode) nvim_buf_get_keymap(buffer, mode)
* api: add metadata for ui eventsBjörn Linse2017-05-10
|
* api: generate ui eventsBjörn Linse2017-05-10
|
* Merge branch 'master' into luaviml'/luaZyX2017-05-08
|\
| * api: Do not translate error messages.Justin M. Keyes2017-04-24
| | | | | | | | | | | | | | | | | | | | Also re-word some error messages: - "Key does not exist: %s" - "Invalid channel: %<PRIu64>" - "Request array size must be 4 (request) or 3 (notification)" - "String cannot contain newlines" References #6150
| * api_set_error(): renameJustin M. Keyes2017-04-23
| |
| * api/internal: Remove `set` field from Error type.Justin M. Keyes2017-04-23
| |
| * api_clear_error: Skip if error was not set.Justin M. Keyes2017-04-23
| |
| * api_clear_error()Justin M. Keyes2017-04-23
| |
| * api: Do not truncate errors <1 MB. #6237Sander Bosma2017-04-23
| | | | | | | | Closes #5984
| * *: Add comment to all C filesZyX2017-04-19
| |
* | Merge branch 'master' into luaviml'/luaZyX2017-04-08
|\|
| * api: {get,set}_option should {get,set} global value of local options (#6405)Jakob Schnitzer2017-03-30
| | | | | | | | | | - nvim_get_option should return the global default of a local option. - nvim_set_option should set the global default of a local option.
| * eval: Move copy_tv to eval/typvalZyX2017-03-29
| |
| * eval,*: Move get_tv_string to typval.cZyX2017-03-29
| | | | | | | | Function was renamed and changed to return `const char *`.
| * *: Move some dictionary functions to typval.h and use char*ZyX2017-03-29
| | | | | | | | Also fixes buffer reusage in setmatches() and complete().
| * eval: Split eval.c into smaller filesZyX2017-03-29
| |
* | api: Also shift numbers in api_metadata outputZyX2017-03-27
| | | | | | | | | | | | Fixes problem introduced by “api: Allow kObjectTypeNil to be zero without breaking compatibility”: apparently there are clients which use metadata and there are which aren’t. For the first that commit would not be needed, for the second that commit misses this critical piece.
* | functests: Test for error conditionsZyX2017-03-27
|/ | | | | | | | | | | | | | | | | | | | | | | 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.
* api: Make sure dict_set_var doesn’t edit read-only valuesZyX2017-02-23
| | | Fixes #6147
* api: Rename dict_set_value to dict_set_varZyX2017-02-23
| | | | | | | | | | | | | | | | | | Reasonings: 1. It is not used for anything, but scope dictionaries currenly. So there is no need to generalize and split it into dict_set_var (which will contain some scope-dictionary-specific checks) and dict_set_value (which will work for any dictionary). 2. Check for key size is no longer valid for non-scope dictionaries: you *can* use empty keys there. In scope dictionaries also, but you actually are not supposed to store there anything, but variables. Note that actually one may still do let b:[''] = 1 and “bypass” check for variable name. It won’t change what `echo b:` will show, but it may affect code which iterates over scope dictionary keys and sets them to something (if there is such code).
* api/helpers: Remove NULL dereference (#6109)Nikolai Aleksandrovich Pavlov2017-02-14
| | | | Even though all used compilers can swallow this code, it is still undefined behaviour.
* Make Nvim work with latest vim-patch v7.4.2024Marco Hinz2017-02-04
| | | | | | | | v7.4.2024 changed a few function signatures of functions that we use in Neovim-specific code, e.g. the API. Due to that the commit for 7.4.2024 doesn't build on its own, only together with this commit.
* eval: Fix failing testZyX2017-01-07
|
* eval: Make sure that copyID is reset when neededZyX2017-01-07
| | | | | Works by making value pushed on stack represent the exhausted list. Fixes #5901, except for dictionaries which need similar adjustment.
* eval/typval_encode: Use TYPVAL_ENCODE_CONV_EMPTY_DICT for partialsZyX2017-01-06
|
* *: Remove `// fname()` comments near typval_encode includesZyX2017-01-04
|
* tests: Add tests for partials dumpingZyX2017-01-03
| | | | | Also fixed dumping of partials by encode_vim_to_object and added code which is able to work with partials and dictionaries to test/unit/eval/helpers.lua (mostly copied from #5119, except for partials handling).
* eval/typval_encode: Refactor arguments to argument macrosesZyX2017-01-03
| | | Fixed local test failures somewhere in process.
* api/helpers: Fix unused variable error in release buildZyX2017-01-03
|
* eval/typval_encode: Refactor big-big macros into .c.h fileZyX2017-01-03
| | | | | This makes gdb backtraces much more meaningful: specifically I now know at which line it crashes in place of seeing that it crashes at TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS macros invocation.
* eval/typval_encode: Make partial conversions not recursiveZyX2017-01-03
| | | | | | Is known to crash in the current state. Ref #5825.
* vim-patch:7.4.1719Michael Ennen2016-12-12
| | | | | | | | | | Problem: Leaking memory when there is a cycle involving a job and a partial. Solution: Add a copyID to job and channel. Set references in items referred by them. Go through all jobs and channels to find unreferenced items. Also, decrement reference counts when garbage collecting. https://github.com/vim/vim/commit/107e1eef1df3b786ad3ad49fbdb9e058649303b5
* vim-patch:7.4.1559Michael Ennen2016-12-12
| | | | | | | Problem: Passing cookie to a callback is clumsy. Solution: Change function() to take arguments and return a partial. https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
* Merge #5752 from justinmk/docJustin M. Keyes2016-12-11
|\ | | | | doc: api_info(), typval_encode.h
| * doc: eval/typval_encode.hJustin M. Keyes2016-10-31
| | | | | | | | Annotate TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS to aid code navigation.
* | lintJames McCoy2016-11-02
| |
* | object_to_vim: Fix buffer/window/tabpage conversion on BE systemsJames McCoy2016-11-02
|/ | | | | | | | | | | 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.
* api: api_info()['version']Justin M. Keyes2016-10-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | API level is disconnected from NVIM version. The API metadata holds the current API level, and the lowest backwards-compatible level supported by this instance. Release 0.1.6 is the first release that reports the Nvim version and API level. metadata['version'] = { major: 0, minor: 1, patch: 6, api_level: 1, api_compatible: 0, api_prerelease: false, } The API level may remain unchanged across Nvim releases if the API has not changed. When changing the API, - set NVIM_API_PRERELEASE to true - increment NVIM_API_LEVEL (at most once per Nvim version) - adjust NVIM_API_LEVEL_COMPAT if backwards-compatibility was broken api_level_0.mpack was generated from Nvim 0.1.5 with: nvim --api-info
* api: Nvim version, API level #5386Rui Abreu Ferreira2016-10-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* api: move verbatim c code out of gendispatch.lua and into c filesBjörn Linse2016-10-19
| | | | | Remove max_fname_len check, which caused false successful lookups, and was an optimization for a very rare case.
* lint: Removing dead initializations #5410Patrick Jackson2016-10-08
|
* api: make nvim[_obj]_set_var and _del_var not return the old valueBjörn Linse2016-09-15
|
* helpers.c: Fix invalid state of failed conversion result for object_to_vim() ↵oni-link2016-09-01
| | | | | | | | | | | (#5282) If a conversion for a container fails in object_to_vim(), the memory for the container in the returned/converted value is freed, but the returned value keeps a pointer to the freed memory. Calling later clear_tv() on this value leads to an invalid memory access. Set v_type to VAR_UNKNOWN in the converted value on failure, so that clear_tv() has no effect.
* api: consistently use nvim_ prefix and update documentationBjörn Linse2016-08-31
|
* api: unify buffer numbers and window ids with handlesBjörn Linse2016-08-31
| | | | also allow handle==0 meaning curbuf/curwin/curtab
* *: Fix linter errorsZyX2016-06-24
| | | | | | | | | Also adds one exception to linter rules: typedef struct { kvec_t(Object) stack; } EncodedData; is completely valid (from the style guide point of view) code.
* api/helpers: Use typval_encode.h for vim_to_objectZyX2016-06-24
| | | | | | | | | | | | | This ought to prevent stack overflow, but I do not see this actually working: *lua* code crashes with stack overflow when trying to deserialize msgpack from Neovim, Neovim is fine even if nesting level is increased 100x (though test becomes very slow); not sure how recursive function may survive this. So it looks like there are currently only two positive effects: 1. NULL lists are returned as empty (#4596). 2. Functional tests are slightly more fast. Very slightly. Checked for Release build for test/functional/eval tests because benchmarking of debug mode is not very useful.
* api: Replace set_var(name, NIL) with del_var(name)ZyX2016-04-18
|