From a1ed941a7881122fda2fd48e71e890ed55e4d08e Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 3 Jan 2021 15:33:21 -0500 Subject: vim-patch:8.2.0861: cannot easily get all the current marks (#13676) Problem: Cannot easily get all the current marks. Solution: Add getmarklist(). (Yegappan Lakshmanan, closes #6032) https://github.com/vim/vim/commit/cfb4b47de08e4437c692d382067dc1692cd83c23 Cherry-pick the column number fix from patch v8.2.0871 because patch v8.2.0871 cannot be fully ported without the method patches. Co-authored-by: Peter Wolf --- src/nvim/eval/funcs.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/nvim/eval/funcs.c') diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 06baed4d5f..8235d74cbb 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -3483,6 +3483,25 @@ static void f_getloclist(typval_T *argvars, typval_T *rettv, FunPtr fptr) get_qf_loc_list(false, wp, &argvars[1], rettv); } + +/// "getmarklist()" function +static void f_getmarklist(typval_T *argvars, typval_T *rettv, FunPtr fptr) +{ + tv_list_alloc_ret(rettv, kListLenMayKnow); + + if (argvars[0].v_type == VAR_UNKNOWN) { + get_global_marks(rettv->vval.v_list); + return; + } + + buf_T *buf = tv_get_buf(&argvars[0], false); + if (buf == NULL) { + return; + } + + get_buf_local_marks(buf, rettv->vval.v_list); +} + /* * "getmatches()" function */ -- cgit