feat(api): add lua C bindings for xdiff (#14536)

* feat(api): add lua C bindings for xdiff

* chore: opt.hunk_lines -> opt.result_type

opt.on_hunk now takes precedence over opt.result_type

* chore: fix indents

Fix indents

* chore: change how priv is managed

Assign priv NULL and unconditionally apply XFREE_CLEAR to it when
finished.
This commit is contained in:
Lewis Russell
2021-08-22 11:22:04 +01:00
committed by GitHub
parent 8331cd13c4
commit 3d3c0c669d
5 changed files with 530 additions and 0 deletions

View File

@@ -40,6 +40,7 @@
#include "nvim/lua/converter.h"
#include "nvim/lua/executor.h"
#include "nvim/lua/treesitter.h"
#include "nvim/lua/xdiff.h"
#include "luv/luv.h"
@@ -517,6 +518,10 @@ static int nlua_state_init(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
// internal vim._treesitter... API
nlua_add_treesitter(lstate);
// vim.diff
lua_pushcfunction(lstate, &nlua_xdl_diff);
lua_setfield(lstate, -2, "diff");
lua_setglobal(lstate, "vim");
{