From e55227f65ffaac6aa93262c7bf1c81e273fd7e2f Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 24 Feb 2018 18:20:30 +0100 Subject: [PATCH] tweaks: unabbreviate two variable names --- src/nano.c | 35 +++++++++++++++++++---------------- src/prompt.c | 52 ++++++++++++++++++++++++++-------------------------- 2 files changed, 45 insertions(+), 42 deletions(-) diff --git a/src/nano.c b/src/nano.c index 6e69a0f9..f218535c 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1630,7 +1630,7 @@ int do_input(bool allow_funcs) /* The length of the input buffer. */ bool retain_cuts = FALSE; /* Whether to conserve the current contents of the cutbuffer. */ - const sc *s; + const sc *shortcut; /* Read in a keystroke, and show the cursor while waiting. */ input = get_kbinput(edit, VISIBLE); @@ -1654,11 +1654,11 @@ int do_input(bool allow_funcs) #endif /* Check for a shortcut in the main list. */ - s = get_shortcut(&input); + shortcut = get_shortcut(&input); /* If we got a non-high-bit control key, a meta key sequence, or a * function key, and it's not a shortcut or toggle, throw it out. */ - if (s == NULL) { + if (shortcut == NULL) { if (is_ascii_cntrl_char(input) || meta_key || !is_byte(input)) { unbound_key(input); input = ERR; @@ -1671,7 +1671,7 @@ int do_input(bool allow_funcs) /* If the keystroke isn't a shortcut nor a toggle, it's a normal text * character: add the character to the input buffer -- or display a * warning when we're in view mode. */ - if (input != ERR && s == NULL) { + if (input != ERR && shortcut == NULL) { if (ISSET(VIEW_MODE)) print_view_warning(); else { @@ -1691,7 +1691,7 @@ int do_input(bool allow_funcs) * characters waiting after the one we read in, we need to output * all available characters in the input puddle. Note that this * puddle will be empty if we're in view mode. */ - if (s || get_key_buffer_len() == 0) { + if (shortcut || get_key_buffer_len() == 0) { if (puddle != NULL) { /* Insert all bytes in the input buffer into the edit buffer * at once, filtering out any low control codes. */ @@ -1705,10 +1705,10 @@ int do_input(bool allow_funcs) } } - if (s == NULL) + if (shortcut == NULL) pletion_line = NULL; else { - const subnfunc *f = sctofunc(s); + const subnfunc *f = sctofunc(shortcut); if (ISSET(VIEW_MODE) && f && !f->viewok) { print_view_warning(); @@ -1717,21 +1717,22 @@ int do_input(bool allow_funcs) /* If the function associated with this shortcut is * cutting or copying text, remember this. */ - if (s->scfunc == do_cut_text_void + if (shortcut->scfunc == do_cut_text_void #ifndef NANO_TINY - || s->scfunc == do_copy_text || s->scfunc == do_cut_till_eof + || shortcut->scfunc == do_copy_text + || shortcut->scfunc == do_cut_till_eof #endif ) retain_cuts = TRUE; #ifdef ENABLE_WORDCOMPLETION - if (s->scfunc != complete_a_word) + if (shortcut->scfunc != complete_a_word) pletion_line = NULL; #endif #ifndef NANO_TINY - if (s->scfunc == do_toggle_void) { - do_toggle(s->toggle); - if (s->toggle != CUT_FROM_CURSOR) + if (shortcut->scfunc == do_toggle_void) { + do_toggle(shortcut->toggle); + if (shortcut->toggle != CUT_FROM_CURSOR) retain_cuts = TRUE; } else #endif @@ -1751,7 +1752,7 @@ int do_input(bool allow_funcs) } #endif /* Execute the function of the shortcut. */ - execute(s); + execute(shortcut); #ifndef NANO_TINY /* When the marked region changes without Shift being held, @@ -1770,14 +1771,16 @@ int do_input(bool allow_funcs) /* If the cursor moved to another line and this was not caused * by adding characters to the buffer, clear the prepend flag. */ if (openfile->current->next != was_next && - s->scfunc != do_tab && s->scfunc != do_verbatim_input) + shortcut->scfunc != do_tab && + shortcut->scfunc != do_verbatim_input) wrap_reset(); #endif #ifdef ENABLE_COLOR if (f && !f->viewok && !refresh_needed) check_the_multis(openfile->current); #endif - if (!refresh_needed && (s->scfunc == do_delete || s->scfunc == do_backspace)) + if (!refresh_needed && (shortcut->scfunc == do_delete || + shortcut->scfunc == do_backspace)) update_line(openfile->current, openfile->current_x); } } diff --git a/src/prompt.c b/src/prompt.c index 3a65d0ce..2ab112c6 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -64,7 +64,7 @@ int do_statusbar_input(bool *ran_func, bool *finished) /* The input buffer. */ static size_t kbinput_len = 0; /* The length of the input buffer. */ - const sc *s; + const sc *shortcut; const subnfunc *f; *ran_func = FALSE; @@ -90,11 +90,11 @@ int do_statusbar_input(bool *ran_func, bool *finished) #endif /* Check for a shortcut in the current list. */ - s = get_shortcut(&input); + shortcut = get_shortcut(&input); /* If we got a non-high-bit control key, a meta key sequence, or a * function key, and it's not a shortcut or toggle, throw it out. */ - if (s == NULL) { + if (shortcut == NULL) { if (is_ascii_cntrl_char(input) || meta_key || !is_byte(input)) { beep(); input = ERR; @@ -103,7 +103,7 @@ int do_statusbar_input(bool *ran_func, bool *finished) /* If the keystroke isn't a shortcut nor a toggle, it's a normal text * character: add the it to the input buffer, when allowed. */ - if (input != ERR && s == NULL) { + if (input != ERR && shortcut == NULL) { /* Only accept input when not in restricted mode, or when not at * the "Write File" prompt, or when there is no filename yet. */ if (!ISSET(RESTRICTED) || currmenu != MWRITEFILE || @@ -117,7 +117,7 @@ int do_statusbar_input(bool *ran_func, bool *finished) /* If we got a shortcut, or if there aren't any other keystrokes waiting * after the one we read in, we need to insert all the characters in the * input buffer (if not empty) into the answer. */ - if ((s || get_key_buffer_len() == 0) && kbinput != NULL) { + if ((shortcut || get_key_buffer_len() == 0) && kbinput != NULL) { /* Inject all characters in the input buffer at once, filtering out * control characters. */ do_statusbar_output(kbinput, kbinput_len, TRUE); @@ -128,42 +128,42 @@ int do_statusbar_input(bool *ran_func, bool *finished) kbinput = NULL; } - if (s) { - if (s->scfunc == do_tab || s->scfunc == do_enter) + if (shortcut) { + if (shortcut->scfunc == do_tab || shortcut->scfunc == do_enter) ; - else if (s->scfunc == do_left) + else if (shortcut->scfunc == do_left) do_statusbar_left(); - else if (s->scfunc == do_right) + else if (shortcut->scfunc == do_right) do_statusbar_right(); #ifndef NANO_TINY - else if (s->scfunc == do_prev_word_void) + else if (shortcut->scfunc == do_prev_word_void) do_statusbar_prev_word(); - else if (s->scfunc == do_next_word_void) + else if (shortcut->scfunc == do_next_word_void) do_statusbar_next_word(); #endif - else if (s->scfunc == do_home) + else if (shortcut->scfunc == do_home) do_statusbar_home(); - else if (s->scfunc == do_end) + else if (shortcut->scfunc == do_end) do_statusbar_end(); /* When in restricted mode at the "Write File" prompt and the * filename isn't blank, disallow any input and deletion. */ else if (ISSET(RESTRICTED) && currmenu == MWRITEFILE && openfile->filename[0] != '\0' && - (s->scfunc == do_verbatim_input || - s->scfunc == do_cut_text_void || - s->scfunc == do_uncut_text || - s->scfunc == do_delete || - s->scfunc == do_backspace)) + (shortcut->scfunc == do_verbatim_input || + shortcut->scfunc == do_cut_text_void || + shortcut->scfunc == do_uncut_text || + shortcut->scfunc == do_delete || + shortcut->scfunc == do_backspace)) ; - else if (s->scfunc == do_verbatim_input) + else if (shortcut->scfunc == do_verbatim_input) do_statusbar_verbatim_input(); - else if (s->scfunc == do_cut_text_void) + else if (shortcut->scfunc == do_cut_text_void) do_statusbar_cut_text(); - else if (s->scfunc == do_delete) + else if (shortcut->scfunc == do_delete) do_statusbar_delete(); - else if (s->scfunc == do_backspace) + else if (shortcut->scfunc == do_backspace) do_statusbar_backspace(); - else if (s->scfunc == do_uncut_text) { + else if (shortcut->scfunc == do_uncut_text) { if (cutbuffer != NULL) do_statusbar_uncut_text(); } else { @@ -171,12 +171,12 @@ int do_statusbar_input(bool *ran_func, bool *finished) * ran_func to TRUE if we try to run their associated functions, * and setting finished to TRUE to indicatethat we're done after * running or trying to run their associated functions. */ - f = sctofunc(s); - if (s->scfunc != NULL) { + f = sctofunc(shortcut); + if (shortcut->scfunc != NULL) { *ran_func = TRUE; if (f && (!ISSET(VIEW_MODE) || f->viewok) && f->scfunc != do_gotolinecolumn_void) - execute(s); + execute(shortcut); } *finished = TRUE; }