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 2da00c98a20e7d9f3f5baa571acadd69fb185b2b

Fix Escape being handled as Ctrl+C in prompts
Ctrl+C suppresses future errors.
Author: xaizek
Author date (UTC): 2024-10-20 08:59
Committer name: xaizek
Committer date (UTC): 2024-10-20 08:59
Parent(s): 2dbd15f4fd36c345fb6ca7f1b9ce89e72a4a616d
Signing key: 99DC5E4DB05F6BE2
Tree: e5d000e31730204fc1391d8dbaba884bdf9cce52
File Lines added Lines deleted
ChangeLog 2 0
src/modes/dialogs/msg_dialog.c 14 1
File ChangeLog changed (mode: 100644) (index 5f84b0d8a..e69370971)
377 377 for an empty string should be done explicitly with `==` or `!=`. Thanks for an empty string should be done explicitly with `==` or `!=`. Thanks
378 378 to justpretending2. to justpretending2.
379 379
380 Fixed Escape being handled as Ctrl+C in prompts (suppresses future errors).
381
380 382 0.13-beta to 0.13 (2023-04-04) 0.13-beta to 0.13 (2023-04-04)
381 383
382 384 Made "withicase" and "withrcase" affect how files are sorted before Made "withicase" and "withrcase" affect how files are sorted before
File src/modes/dialogs/msg_dialog.c changed (mode: 100644) (index d5a8da45a..6cef79d06)
... ... typedef enum
62 62 { {
63 63 DR_OK, /* Agreed. */ DR_OK, /* Agreed. */
64 64 DR_CANCEL, /* Cancelled. */ DR_CANCEL, /* Cancelled. */
65 DR_CLOSE, /* Closed. */
65 66 DR_YES, /* Confirmed. */ DR_YES, /* Confirmed. */
66 67 DR_NO, /* Denied. */ DR_NO, /* Denied. */
67 68 DR_CUSTOM, /* One of user-specified keys. */ DR_CUSTOM, /* One of user-specified keys. */
 
... ... static int def_handler(wchar_t key);
89 90 static void cmd_ctrl_c(key_info_t key_info, keys_info_t *keys_info); static void cmd_ctrl_c(key_info_t key_info, keys_info_t *keys_info);
90 91 static void cmd_ctrl_l(key_info_t key_info, keys_info_t *keys_info); static void cmd_ctrl_l(key_info_t key_info, keys_info_t *keys_info);
91 92 static void cmd_ctrl_m(key_info_t key_info, keys_info_t *keys_info); static void cmd_ctrl_m(key_info_t key_info, keys_info_t *keys_info);
93 static void cmd_esc(key_info_t key_info, keys_info_t *keys_info);
92 94 static void cmd_n(key_info_t key_info, keys_info_t *keys_info); static void cmd_n(key_info_t key_info, keys_info_t *keys_info);
93 95 static void cmd_y(key_info_t key_info, keys_info_t *keys_info); static void cmd_y(key_info_t key_info, keys_info_t *keys_info);
94 96 static void handle_response(dialog_data_t *data, DialogResult dr); static void handle_response(dialog_data_t *data, DialogResult dr);
 
... ... static keys_add_info_t builtin_cmds[] = {
115 117 {WK_C_c, {{&cmd_ctrl_c}, .descr = "cancel"}}, {WK_C_c, {{&cmd_ctrl_c}, .descr = "cancel"}},
116 118 {WK_C_l, {{&cmd_ctrl_l}, .descr = "redraw"}}, {WK_C_l, {{&cmd_ctrl_l}, .descr = "redraw"}},
117 119 {WK_C_m, {{&cmd_ctrl_m}, .descr = "agree to the query"}}, {WK_C_m, {{&cmd_ctrl_m}, .descr = "agree to the query"}},
118 {WK_ESC, {{&cmd_ctrl_c}, .descr = "cancel"}},
120 {WK_ESC, {{&cmd_esc}, .descr = "close"}},
119 121 {WK_n, {{&cmd_n}, .descr = "deny the query"}}, {WK_n, {{&cmd_n}, .descr = "deny the query"}},
120 122 {WK_y, {{&cmd_y}, .descr = "confirm the query"}}, {WK_y, {{&cmd_y}, .descr = "confirm the query"}},
121 123 }; };
 
... ... cmd_ctrl_m(key_info_t key_info, keys_info_t *keys_info)
183 185 handle_response(current_dialog, DR_OK); handle_response(current_dialog, DR_OK);
184 186 } }
185 187
188 /* Closes the query. */
189 static void
190 cmd_esc(key_info_t key_info, keys_info_t *keys_info)
191 {
192 handle_response(current_dialog, DR_CLOSE);
193 }
194
186 195 /* Denies the query. */ /* Denies the query. */
187 196 static void static void
188 197 cmd_n(key_info_t key_info, keys_info_t *keys_info) cmd_n(key_info_t key_info, keys_info_t *keys_info)
 
... ... handle_response(dialog_data_t *data, DialogResult dr)
205 214 /* Map result to corresponding input key to omit branching per handler. */ /* Map result to corresponding input key to omit branching per handler. */
206 215 static const char r_to_c[] = { static const char r_to_c[] = {
207 216 [DR_OK] = '\r', [DR_OK] = '\r',
217 /* DR_CLOSE used to be part of DR_CANCEL, update handlers if there is a need
218 * to differentiate between them in handlers. */
208 219 [DR_CANCEL] = NC_C_c, [DR_CANCEL] = NC_C_c,
220 [DR_CLOSE] = NC_C_c,
209 221 [DR_YES] = 'y', [DR_YES] = 'y',
210 222 [DR_NO] = 'n', [DR_NO] = 'n',
211 223 }; };
224 ARRAY_GUARD(r_to_c, DR_CUSTOM);
212 225
213 226 (void)def_handler(r_to_c[dr]); (void)def_handler(r_to_c[dr]);
214 227 /* Default handler might have already requested quitting. */ /* Default handler might have already requested quitting. */
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