diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-01-03 15:33:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-03 15:33:21 -0500 |
commit | a1ed941a7881122fda2fd48e71e890ed55e4d08e (patch) | |
tree | 8fc3e1fcdf98861d8f6ca0c59de55814e6a73d79 /src/nvim/eval/funcs.c | |
parent | fff4facdc47a0c8d088256af4d07c792b38b4a03 (diff) | |
download | rneovim-a1ed941a7881122fda2fd48e71e890ed55e4d08e.tar.gz rneovim-a1ed941a7881122fda2fd48e71e890ed55e4d08e.tar.bz2 rneovim-a1ed941a7881122fda2fd48e71e890ed55e4d08e.zip |
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 <pwolf2310@gmail.com>
Diffstat (limited to 'src/nvim/eval/funcs.c')
-rw-r--r-- | src/nvim/eval/funcs.c | 19 |
1 files changed, 19 insertions, 0 deletions
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 */ |