xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit a8a113b89b96dab37ed6657b691aeb0ec84f2865

Move lua/{vifm_cmds => common}.c:push_str_array()
Author: xaizek
Author date (UTC): 2022-03-19 19:38
Committer name: xaizek
Committer date (UTC): 2022-03-19 19:38
Parent(s): 4341eb6b684f66fe84d948259170e78a5cb16210
Signing key: 99DC5E4DB05F6BE2
Tree: 1eae55eae9cb2c31cb8029f8b86a70debef861f1
File Lines added Lines deleted
src/lua/common.c 12 0
src/lua/common.h 3 0
src/lua/vifm_cmds.c 0 14
File src/lua/common.c changed (mode: 100644) (index dd7eaa701..c6f7152cf)
... ... set_opt(lua_State *lua, opt_t *opt)
162 162 return 0; return 0;
163 163 } }
164 164
165 void
166 push_str_array(lua_State *lua, char *array[], int len)
167 {
168 int i;
169 lua_newtable(lua);
170 for(i = 0; i < len; ++i)
171 {
172 lua_pushstring(lua, array[i]);
173 lua_seti(lua, -2, i + 1);
174 }
175 }
176
165 177 /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */
166 178 /* vim: set cinoptions+=t0 : */ /* vim: set cinoptions+=t0 : */
File src/lua/common.h changed (mode: 100644) (index 545cbb91c..1b9391ac1)
... ... int get_opt(struct lua_State *lua, struct opt_t *opt);
56 56 * always zero. */ * always zero. */
57 57 int set_opt(struct lua_State *lua, struct opt_t *opt); int set_opt(struct lua_State *lua, struct opt_t *opt);
58 58
59 /* Creates an array of strings and leaves it on the top of the stack. */
60 void push_str_array(struct lua_State *lua, char *array[], int len);
61
59 62 #endif /* VIFM__LUA__COMMON_H__ */ #endif /* VIFM__LUA__COMMON_H__ */
60 63
61 64 /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */
File src/lua/vifm_cmds.c changed (mode: 100644) (index 76888c540..b746fdf66)
... ... static void parse_cmd_params(vlua_t *vlua, cmd_add_t *cmd);
37 37 static int VLUA_API(cmds_command)(lua_State *lua); static int VLUA_API(cmds_command)(lua_State *lua);
38 38 static int VLUA_API(cmds_delcommand)(lua_State *lua); static int VLUA_API(cmds_delcommand)(lua_State *lua);
39 39 static int lua_cmd_handler(const cmd_info_t *cmd_info); static int lua_cmd_handler(const cmd_info_t *cmd_info);
40 static void push_str_array(lua_State *lua, char *array[], int len);
41 40 static int apply_completion(lua_State *lua, const char str[]); static int apply_completion(lua_State *lua, const char str[]);
42 41
43 42 VLUA_DECLARE_SAFE(cmds_add); VLUA_DECLARE_SAFE(cmds_add);
 
... ... vifm_cmds_complete(lua_State *lua, const cmd_info_t *cmd_info, int arg_pos)
244 243 return apply_completion(lua, cmd_info->args + arg_pos); return apply_completion(lua, cmd_info->args + arg_pos);
245 244 } }
246 245
247 /* Creates an array of strings and leaves it on the top of the stack. */
248 static void
249 push_str_array(lua_State *lua, char *array[], int len)
250 {
251 int i;
252 lua_newtable(lua);
253 for(i = 0; i < len; ++i)
254 {
255 lua_pushstring(lua, array[i]);
256 lua_seti(lua, -2, i + 1);
257 }
258 }
259
260 246 /* Does stack cleanup for the caller (-2). Returns offset of completion /* Does stack cleanup for the caller (-2). Returns offset of completion
261 247 * matches. */ * matches. */
262 248 static int static int
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master