tweaks: remove three unneeded while loops from two input routines
The whiles are unneeded because the result of get_input() can never be NULL when in waiting mode -- and only when searching for something are we NOT in waiting mode.master
parent
3e899b15c2
commit
5ca4e9f5b3
14
src/winio.c
14
src/winio.c
|
@ -913,12 +913,9 @@ int parse_kbinput(WINDOW *win)
|
||||||
/* Read in a character. */
|
/* Read in a character. */
|
||||||
kbinput = get_input(win, 1);
|
kbinput = get_input(win, 1);
|
||||||
|
|
||||||
if (kbinput == NULL && !waiting_mode)
|
if (kbinput == NULL)
|
||||||
return ERR;
|
return ERR;
|
||||||
|
|
||||||
while (kbinput == NULL)
|
|
||||||
kbinput = get_input(win, 1);
|
|
||||||
|
|
||||||
keycode = *kbinput;
|
keycode = *kbinput;
|
||||||
free(kbinput);
|
free(kbinput);
|
||||||
|
|
||||||
|
@ -1372,13 +1369,12 @@ long assemble_unicode(int symbol)
|
||||||
* multibyte sequence), or 2 (for an iTerm/Eterm/rxvt double Escape). */
|
* multibyte sequence), or 2 (for an iTerm/Eterm/rxvt double Escape). */
|
||||||
int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
|
int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
|
||||||
{
|
{
|
||||||
int *kbinput = NULL;
|
int *kbinput;
|
||||||
|
|
||||||
reveal_cursor = TRUE;
|
reveal_cursor = TRUE;
|
||||||
|
|
||||||
/* Read in the first code. */
|
/* Read in the first code. */
|
||||||
while (kbinput == NULL)
|
kbinput = get_input(win, 1);
|
||||||
kbinput = get_input(win, 1);
|
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* When the window was resized, abort and return nothing. */
|
/* When the window was resized, abort and return nothing. */
|
||||||
|
@ -1404,9 +1400,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
|
||||||
|
|
||||||
while (unicode == PROCEED) {
|
while (unicode == PROCEED) {
|
||||||
free(kbinput);
|
free(kbinput);
|
||||||
kbinput = NULL;
|
kbinput = get_input(win, 1);
|
||||||
while (kbinput == NULL)
|
|
||||||
kbinput = get_input(win, 1);
|
|
||||||
unicode = assemble_unicode(*kbinput);
|
unicode = assemble_unicode(*kbinput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue