Commit b77b54bf authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

tweaks: elide two unneeded booleans

No related merge requests found
Showing with 8 additions and 18 deletions
+8 -18
...@@ -1631,7 +1631,6 @@ int do_input(bool allow_funcs) ...@@ -1631,7 +1631,6 @@ int do_input(bool allow_funcs)
bool retain_cuts = FALSE; bool retain_cuts = FALSE;
/* Whether to conserve the current contents of the cutbuffer. */ /* Whether to conserve the current contents of the cutbuffer. */
const sc *s; const sc *s;
bool have_shortcut;
/* Read in a keystroke, and show the cursor while waiting. */ /* Read in a keystroke, and show the cursor while waiting. */
input = get_kbinput(edit, VISIBLE); input = get_kbinput(edit, VISIBLE);
...@@ -1657,13 +1656,9 @@ int do_input(bool allow_funcs) ...@@ -1657,13 +1656,9 @@ int do_input(bool allow_funcs)
/* Check for a shortcut in the main list. */ /* Check for a shortcut in the main list. */
s = get_shortcut(&input); s = get_shortcut(&input);
/* If we got a shortcut from the main list, or a "universal"
* edit window shortcut, set have_shortcut to TRUE. */
have_shortcut = (s != NULL);
/* If we got a non-high-bit control key, a meta key sequence, or a /* 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. */ * function key, and it's not a shortcut or toggle, throw it out. */
if (!have_shortcut) { if (s == NULL) {
if (is_ascii_cntrl_char(input) || meta_key || !is_byte(input)) { if (is_ascii_cntrl_char(input) || meta_key || !is_byte(input)) {
unbound_key(input); unbound_key(input);
input = ERR; input = ERR;
...@@ -1676,7 +1671,7 @@ int do_input(bool allow_funcs) ...@@ -1676,7 +1671,7 @@ int do_input(bool allow_funcs)
/* If the keystroke isn't a shortcut nor a toggle, it's a normal text /* 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 * character: add the character to the input buffer -- or display a
* warning when we're in view mode. */ * warning when we're in view mode. */
if (input != ERR && !have_shortcut) { if (input != ERR && s == NULL) {
if (ISSET(VIEW_MODE)) if (ISSET(VIEW_MODE))
print_view_warning(); print_view_warning();
else { else {
...@@ -1696,7 +1691,7 @@ int do_input(bool allow_funcs) ...@@ -1696,7 +1691,7 @@ int do_input(bool allow_funcs)
* characters waiting after the one we read in, we need to output * characters waiting after the one we read in, we need to output
* all available characters in the input puddle. Note that this * all available characters in the input puddle. Note that this
* puddle will be empty if we're in view mode. */ * puddle will be empty if we're in view mode. */
if (have_shortcut || get_key_buffer_len() == 0) { if (s || get_key_buffer_len() == 0) {
if (puddle != NULL) { if (puddle != NULL) {
/* Insert all bytes in the input buffer into the edit buffer /* Insert all bytes in the input buffer into the edit buffer
* at once, filtering out any low control codes. */ * at once, filtering out any low control codes. */
...@@ -1710,7 +1705,7 @@ int do_input(bool allow_funcs) ...@@ -1710,7 +1705,7 @@ int do_input(bool allow_funcs)
} }
} }
if (!have_shortcut) if (s == NULL)
pletion_line = NULL; pletion_line = NULL;
else { else {
const subnfunc *f = sctofunc(s); const subnfunc *f = sctofunc(s);
......
...@@ -65,7 +65,6 @@ int do_statusbar_input(bool *ran_func, bool *finished) ...@@ -65,7 +65,6 @@ int do_statusbar_input(bool *ran_func, bool *finished)
static size_t kbinput_len = 0; static size_t kbinput_len = 0;
/* The length of the input buffer. */ /* The length of the input buffer. */
const sc *s; const sc *s;
bool have_shortcut = FALSE;
const subnfunc *f; const subnfunc *f;
*ran_func = FALSE; *ran_func = FALSE;
...@@ -93,13 +92,9 @@ int do_statusbar_input(bool *ran_func, bool *finished) ...@@ -93,13 +92,9 @@ int do_statusbar_input(bool *ran_func, bool *finished)
/* Check for a shortcut in the current list. */ /* Check for a shortcut in the current list. */
s = get_shortcut(&input); s = get_shortcut(&input);
/* If we got a shortcut from the current list, or a "universal"
* statusbar prompt shortcut, set have_shortcut to TRUE. */
have_shortcut = (s != NULL);
/* If we got a non-high-bit control key, a meta key sequence, or a /* 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. */ * function key, and it's not a shortcut or toggle, throw it out. */
if (!have_shortcut) { if (s == NULL) {
if (is_ascii_cntrl_char(input) || meta_key || !is_byte(input)) { if (is_ascii_cntrl_char(input) || meta_key || !is_byte(input)) {
beep(); beep();
input = ERR; input = ERR;
...@@ -108,7 +103,7 @@ int do_statusbar_input(bool *ran_func, bool *finished) ...@@ -108,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 /* 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. */ * character: add the it to the input buffer, when allowed. */
if (input != ERR && !have_shortcut) { if (input != ERR && s == NULL) {
/* Only accept input when not in restricted mode, or when not at /* Only accept input when not in restricted mode, or when not at
* the "Write File" prompt, or when there is no filename yet. */ * the "Write File" prompt, or when there is no filename yet. */
if (!ISSET(RESTRICTED) || currmenu != MWRITEFILE || if (!ISSET(RESTRICTED) || currmenu != MWRITEFILE ||
...@@ -122,7 +117,7 @@ int do_statusbar_input(bool *ran_func, bool *finished) ...@@ -122,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 /* 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 * after the one we read in, we need to insert all the characters in the
* input buffer (if not empty) into the answer. */ * input buffer (if not empty) into the answer. */
if ((have_shortcut || get_key_buffer_len() == 0) && kbinput != NULL) { if ((s || get_key_buffer_len() == 0) && kbinput != NULL) {
/* Inject all characters in the input buffer at once, filtering out /* Inject all characters in the input buffer at once, filtering out
* control characters. */ * control characters. */
do_statusbar_output(kbinput, kbinput_len, TRUE); do_statusbar_output(kbinput, kbinput_len, TRUE);
...@@ -133,7 +128,7 @@ int do_statusbar_input(bool *ran_func, bool *finished) ...@@ -133,7 +128,7 @@ int do_statusbar_input(bool *ran_func, bool *finished)
kbinput = NULL; kbinput = NULL;
} }
if (have_shortcut) { if (s) {
if (s->scfunc == do_tab || s->scfunc == do_enter) if (s->scfunc == do_tab || s->scfunc == do_enter)
; ;
else if (s->scfunc == do_left) else if (s->scfunc == do_left)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment