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 8bc87204936449a36f700e79783b0b4ec46abab8

Test suggestions of keys in the event loop
Author: xaizek
Author date (UTC): 2025-06-12 18:32
Committer name: xaizek
Committer date (UTC): 2025-06-12 18:32
Parent(s): 916328c8541c83269783015eb53ef3640cb67b9a
Signing key: 99DC5E4DB05F6BE2
Tree: df8311ba994e9a13014f04f0a64484456305b4d3
File Lines added Lines deleted
tests/misc/event_loop.c 28 0
File tests/misc/event_loop.c changed (mode: 100644) (index a7c3ab40d..ade3ff724)
4 4
5 5 #include "../../src/cfg/config.h" #include "../../src/cfg/config.h"
6 6 #include "../../src/engine/cmds.h" #include "../../src/engine/cmds.h"
7 #include "../../src/engine/completion.h"
7 8 #include "../../src/engine/keys.h" #include "../../src/engine/keys.h"
8 9 #include "../../src/engine/mode.h" #include "../../src/engine/mode.h"
9 10 #include "../../src/lua/vlua.h" #include "../../src/lua/vlua.h"
 
... ... TEST(pending_flags_are_reset)
157 158 curr_stats.vlua = NULL; curr_stats.vlua = NULL;
158 159 } }
159 160
161 TEST(key_suggestions)
162 {
163 cfg.sug.flags = SF_NORMAL | SF_KEYS;
164 cfg.min_timeout_len = 1;
165
166 keys_add_info_t x_key = { WK_X, { {&X_key} } };
167 vle_keys_add(&x_key, 1U, NORMAL_MODE);
168
169 assert_success(vle_keys_user_add(L"Xj", L"j", NORMAL_MODE, KEYS_FLAG_NONE));
170 assert_success(vle_keys_user_add(L"Xk", L"k", NORMAL_MODE, KEYS_FLAG_NONE));
171
172 feed_keys(L"X");
173
174 quit = 0;
175 event_loop(&quit, /*manage_marking=*/1);
176
177 const vle_compl_t *items = vle_compl_get_items();
178 assert_int_equal(2, vle_compl_get_count());
179 assert_string_equal("key: j", items[0].text);
180 assert_string_equal("j", items[0].descr);
181 assert_string_equal("key: k", items[1].text);
182 assert_string_equal("k", items[1].descr);
183
184 cfg.sug.flags = 0;
185 cfg.min_timeout_len = 0;
186 }
187
160 188 static void static void
161 189 x_key(key_info_t key_info, keys_info_t *keys_info) x_key(key_info_t key_info, keys_info_t *keys_info)
162 190 { {
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