tweaks: weld two fragments together, twice, by eliding an unneeded 'if'
The get_kbinput() routine will never return ERR, so there is no need to check for that.master
parent
0a31a9aa38
commit
0ed62e84de
12
src/nano.c
12
src/nano.c
|
@ -1531,17 +1531,9 @@ void do_input(void)
|
||||||
/* 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 (shortcut == NULL) {
|
if (shortcut == NULL) {
|
||||||
if (input < 0x20 || input > 0xFF || meta_key) {
|
if (input < 0x20 || input > 0xFF || meta_key)
|
||||||
unbound_key(input);
|
unbound_key(input);
|
||||||
input = ERR;
|
else if (ISSET(VIEW_MODE))
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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 && shortcut == NULL) {
|
|
||||||
if (ISSET(VIEW_MODE))
|
|
||||||
print_view_warning();
|
print_view_warning();
|
||||||
else {
|
else {
|
||||||
/* Store the byte, and leave room for a terminating zero. */
|
/* Store the byte, and leave room for a terminating zero. */
|
||||||
|
|
11
src/prompt.c
11
src/prompt.c
|
@ -90,18 +90,11 @@ int do_statusbar_input(bool *finished)
|
||||||
/* 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 (shortcut == NULL) {
|
if (shortcut == NULL) {
|
||||||
if (input < 0x20 || input > 0xFF || meta_key) {
|
if (input < 0x20 || input > 0xFF || meta_key)
|
||||||
beep();
|
beep();
|
||||||
input = ERR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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 && shortcut == 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 ||
|
else if (!ISSET(RESTRICTED) || currmenu != MWRITEFILE ||
|
||||||
openfile->filename[0] == '\0') {
|
openfile->filename[0] == '\0') {
|
||||||
kbinput_len++;
|
kbinput_len++;
|
||||||
kbinput = (int *)nrealloc(kbinput, kbinput_len * sizeof(int));
|
kbinput = (int *)nrealloc(kbinput, kbinput_len * sizeof(int));
|
||||||
|
|
Loading…
Reference in New Issue