0
0
mirror of https://github.com/vim/vim.git synced 2025-10-13 06:54:15 -04:00

patch 8.1.0313: information about a swap file is unavailable

Problem:    Information about a swap file is unavailable.
Solution:   Add swapinfo(). (Enzo Ferber)
This commit is contained in:
Bram Moolenaar
2018-08-21 20:28:54 +02:00
parent 8e82c057ff
commit 00f123a565
6 changed files with 110 additions and 1 deletions

View File

@@ -398,6 +398,7 @@ static void f_strdisplaywidth(typval_T *argvars, typval_T *rettv);
static void f_strwidth(typval_T *argvars, typval_T *rettv);
static void f_submatch(typval_T *argvars, typval_T *rettv);
static void f_substitute(typval_T *argvars, typval_T *rettv);
static void f_swapinfo(typval_T *argvars, typval_T *rettv);
static void f_synID(typval_T *argvars, typval_T *rettv);
static void f_synIDattr(typval_T *argvars, typval_T *rettv);
static void f_synIDtrans(typval_T *argvars, typval_T *rettv);
@@ -859,6 +860,7 @@ static struct fst
{"strwidth", 1, 1, f_strwidth},
{"submatch", 1, 2, f_submatch},
{"substitute", 4, 4, f_substitute},
{"swapinfo", 1, 1, f_swapinfo},
{"synID", 3, 3, f_synID},
{"synIDattr", 2, 3, f_synIDattr},
{"synIDtrans", 1, 1, f_synIDtrans},
@@ -12313,6 +12315,16 @@ f_substitute(typval_T *argvars, typval_T *rettv)
rettv->vval.v_string = do_string_sub(str, pat, sub, expr, flg);
}
/*
* "swapinfo(swap_filename)" function
*/
static void
f_swapinfo(typval_T *argvars, typval_T *rettv)
{
if (rettv_dict_alloc(rettv) == OK)
get_b0_dict(get_tv_string(argvars), rettv->vval.v_dict);
}
/*
* "synID(lnum, col, trans)" function
*/