tweaks: rename a symbol, away from an obscure abbreviation

Also, reshuffle its definition, and change its value to match
other special codes.
This commit is contained in:
Benno Schulenberg 2024-07-15 08:43:38 +02:00
parent 887803cb67
commit c53839cefa
7 changed files with 20 additions and 18 deletions

View File

@ -498,11 +498,11 @@ char *browse(char *path)
#ifndef NANO_TINY #ifndef NANO_TINY
/* Simulate a terminal resize to force a directory reread, /* Simulate a terminal resize to force a directory reread,
* or because the terminal dimensions might have changed. */ * or because the terminal dimensions might have changed. */
kbinput = KEY_WINCH; kbinput = THE_WINDOW_RESIZED;
} else if (function == do_toggle && get_shortcut(kbinput)->toggle == NO_HELP) { } else if (function == do_toggle && get_shortcut(kbinput)->toggle == NO_HELP) {
TOGGLE(NO_HELP); TOGGLE(NO_HELP);
window_init(); window_init();
kbinput = KEY_WINCH; kbinput = THE_WINDOW_RESIZED;
#endif #endif
} else if (function == do_search_backward) { } else if (function == do_search_backward) {
search_filename(BACKWARD); search_filename(BACKWARD);
@ -642,7 +642,7 @@ char *browse(char *path)
implant(first_sc_for(MBROWSER, function)->expansion); implant(first_sc_for(MBROWSER, function)->expansion);
#endif #endif
#ifndef NANO_TINY #ifndef NANO_TINY
} else if (kbinput == KEY_WINCH) { } else if (kbinput == THE_WINDOW_RESIZED) {
; /* Gets handled below. */ ; /* Gets handled below. */
#endif #endif
} else if (function == do_exit) { } else if (function == do_exit) {
@ -652,7 +652,7 @@ char *browse(char *path)
#ifndef NANO_TINY #ifndef NANO_TINY
/* If the terminal resized (or might have), refresh the file list. */ /* If the terminal resized (or might have), refresh the file list. */
if (kbinput == KEY_WINCH) { if (kbinput == THE_WINDOW_RESIZED) {
/* Remember the selected file, to be able to reselect it. */ /* Remember the selected file, to be able to reselect it. */
present_name = copy_of(filelist[selected]); present_name = copy_of(filelist[selected]);
goto read_directory_contents; goto read_directory_contents;

View File

@ -227,9 +227,14 @@
#define PLANTED_A_COMMAND 0x4EC #define PLANTED_A_COMMAND 0x4EC
#define NO_SUCH_FUNCTION 0x4EF #define NO_SUCH_FUNCTION 0x4EF
#ifndef NANO_TINY
/* A special keycode for Ctrl + the central key on the numeric keypad. */ /* A special keycode for Ctrl + the central key on the numeric keypad. */
#define KEY_CENTER 0x4F0 #define KEY_CENTER 0x4F0
/* A special keycode for when we get a SIGWINCH (a window resize). */
#define THE_WINDOW_RESIZED 0x4F7
#endif
/* A special keycode to signal the beginning and end of a bracketed paste. */ /* A special keycode to signal the beginning and end of a bracketed paste. */
#define BRACKETED_PASTE_MARKER 0x4FB #define BRACKETED_PASTE_MARKER 0x4FB
@ -240,9 +245,6 @@
#define KEY_FRESH 0x4FE #define KEY_FRESH 0x4FE
#ifndef NANO_TINY #ifndef NANO_TINY
/* A special keycode for when we get a SIGWINCH (a window resize). */
#define KEY_WINCH -2
/* Some extra flags for the undo function. */ /* Some extra flags for the undo function. */
#define WAS_BACKSPACE_AT_EOF (1<<1) #define WAS_BACKSPACE_AT_EOF (1<<1)
#define WAS_WHOLE_LINE (1<<2) #define WAS_WHOLE_LINE (1<<2)

View File

@ -513,7 +513,7 @@ void show_help(void)
get_mouseinput(&dummy_row, &dummy_col, TRUE); get_mouseinput(&dummy_row, &dummy_col, TRUE);
#endif #endif
#ifndef NANO_TINY #ifndef NANO_TINY
} else if (kbinput == KEY_WINCH) { } else if (kbinput == THE_WINDOW_RESIZED) {
; /* Nothing to do. */ ; /* Nothing to do. */
#endif #endif
} else if (function == do_exit) { } else if (function == do_exit) {

View File

@ -1592,7 +1592,7 @@ void process_a_keystroke(void)
lastmessage = VACUUM; lastmessage = VACUUM;
#ifndef NANO_TINY #ifndef NANO_TINY
if (input == KEY_WINCH) if (input == THE_WINDOW_RESIZED)
return; return;
#endif #endif
#ifdef ENABLE_MOUSE #ifdef ENABLE_MOUSE

View File

@ -442,9 +442,9 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
#ifndef NANO_TINY #ifndef NANO_TINY
/* If the window size changed, go reformat the prompt string. */ /* If the window size changed, go reformat the prompt string. */
if (input == KEY_WINCH) { if (input == THE_WINDOW_RESIZED) {
refresh_func(); /* Only needed when in file browser. */ refresh_func(); /* Only needed when in file browser. */
*actual = KEY_WINCH; *actual = THE_WINDOW_RESIZED;
#ifdef ENABLE_HISTORIES #ifdef ENABLE_HISTORIES
free(stored_string); free(stored_string);
#endif #endif
@ -598,7 +598,7 @@ int do_prompt(int menu, const char *provided, linestruct **history_list,
free(prompt); free(prompt);
#ifndef NANO_TINY #ifndef NANO_TINY
if (retval == KEY_WINCH) if (retval == THE_WINDOW_RESIZED)
goto redo_theprompt; goto redo_theprompt;
#endif #endif
@ -697,7 +697,7 @@ int ask_user(bool withall, const char *question)
kbinput = get_kbinput(footwin, !withall); kbinput = get_kbinput(footwin, !withall);
#ifndef NANO_TINY #ifndef NANO_TINY
if (kbinput == KEY_WINCH) if (kbinput == THE_WINDOW_RESIZED)
continue; continue;
/* Accept first character of an external paste and ignore the rest. */ /* Accept first character of an external paste and ignore the rest. */

View File

@ -2877,7 +2877,7 @@ void do_linter(void)
kbinput = get_kbinput(footwin, VISIBLE); kbinput = get_kbinput(footwin, VISIBLE);
#ifndef NANO_TINY #ifndef NANO_TINY
if (kbinput == KEY_WINCH) if (kbinput == THE_WINDOW_RESIZED)
continue; continue;
#endif #endif
function = func_from_key(kbinput); function = func_from_key(kbinput);

View File

@ -218,7 +218,7 @@ void read_keys_from(WINDOW *frame)
#ifndef NANO_TINY #ifndef NANO_TINY
if (the_window_resized) { if (the_window_resized) {
regenerate_screen(); regenerate_screen();
input = KEY_WINCH; input = THE_WINDOW_RESIZED;
} }
if (timed) { if (timed) {
@ -272,7 +272,7 @@ void read_keys_from(WINDOW *frame)
} }
/* If we got a SIGWINCH, get out as the frame argument is no longer valid. */ /* If we got a SIGWINCH, get out as the frame argument is no longer valid. */
if (input == KEY_WINCH) if (input == THE_WINDOW_RESIZED)
return; return;
/* Remember where the recording of this keystroke (or burst of them) started. */ /* Remember where the recording of this keystroke (or burst of them) started. */
@ -1445,7 +1445,7 @@ int *parse_verbatim_kbinput(WINDOW *frame, size_t *count)
#ifndef NANO_TINY #ifndef NANO_TINY
/* When the window was resized, abort and return nothing. */ /* When the window was resized, abort and return nothing. */
if (keycode == KEY_WINCH) { if (keycode == THE_WINDOW_RESIZED) {
*count = 999; *count = 999;
return NULL; return NULL;
} }
@ -1469,7 +1469,7 @@ int *parse_verbatim_kbinput(WINDOW *frame, size_t *count)
} }
#ifndef NANO_TINY #ifndef NANO_TINY
if (keycode == KEY_WINCH) { if (keycode == THE_WINDOW_RESIZED) {
*count = 999; *count = 999;
free(yield); free(yield);
return NULL; return NULL;