From bfd007ca946c06d1d5743a0dcf97d454d27ec6e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 22 Feb 2017 23:25:34 +0100 Subject: vis-lua: expose current count specifier as vis:count --- vis-lua.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vis-lua.c b/vis-lua.c index 46f3a24..1cb8c16 100644 --- a/vis-lua.c +++ b/vis-lua.c @@ -563,6 +563,10 @@ static const char *keymapping(Vis *vis, const char *keys, const Arg *arg) { * LPeg lexer module. * @field lpeg might be `nil` if module is not found */ +/*** + * Current count. + * @tfield int count the specified count for the current command or `nil` if none was given + */ /*** * Create an iterator over all windows. @@ -1111,6 +1115,15 @@ static int vis_index(lua_State *L) { return 1; } + if (strcmp(key, "count") == 0) { + int count = vis_count_get(vis); + if (count == VIS_COUNT_UNKNOWN) + lua_pushnil(L); + else + lua_pushunsigned(L, count); + return 1; + } + if (strcmp(key, "registers") == 0) { obj_ref_new(L, vis->ui, "vis.registers"); return 1; -- cgit v1.2.3