tweaks: update several comments after the previous changes

This commit is contained in:
Benno Schulenberg 2020-02-12 12:05:52 +01:00
parent 0ed62e84de
commit 71daa1ef6b
3 changed files with 13 additions and 25 deletions

View File

@ -1528,8 +1528,7 @@ void do_input(void)
/* Check for a shortcut in the main list. */
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 not a command, discard anything that is not a normal character byte. */
if (shortcut == NULL) {
if (input < 0x20 || input > 0xFF || meta_key)
unbound_key(input);
@ -1548,18 +1547,14 @@ void do_input(void)
#endif
}
/* If we got a shortcut or toggle, or if there aren't any other
* 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 we have a command, or if there aren't any other key codes waiting,
* it's time to insert the gathered bytes into the current buffer. */
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 ASCII control codes. */
puddle[depth] = '\0';
inject(puddle, depth);
/* Empty the input buffer. */
/* Empty the little input buffer. */
free(puddle);
puddle = NULL;
depth = 0;
@ -1646,8 +1641,7 @@ void do_input(void)
#endif
}
/* The user typed output_len multibyte characters. Add them to the edit
* buffer, filtering out ASCII control characters when filtering is TRUE. */
/* The user typed output_len multibyte characters. Add them to the buffer. */
void inject(char *output, size_t output_len)
{
char onechar[MAXCHARLEN];

View File

@ -87,13 +87,12 @@ int do_statusbar_input(bool *finished)
/* Check for a shortcut in the current list. */
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 not a command, discard anything that is not a normal character byte.
* Apart from that, only accept input when not in restricted mode, or when
* not at the "Write File" prompt, or when there is no filename yet. */
if (shortcut == NULL) {
if (input < 0x20 || input > 0xFF || meta_key)
beep();
/* Only accept input when not in restricted mode, or when not at
* the "Write File" prompt, or when there is no filename yet. */
else if (!ISSET(RESTRICTED) || currmenu != MWRITEFILE ||
openfile->filename[0] == '\0') {
kbinput_len++;
@ -102,15 +101,11 @@ int do_statusbar_input(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 we got a shortcut, or if there aren't any other keystrokes waiting,
* it's time to insert all characters in the input buffer (if not empty)
* into the answer, and then clear the input buffer. */
if ((shortcut || get_key_buffer_len() == 0) && kbinput != NULL) {
/* Inject all characters in the input buffer at once, filtering out
* control characters. */
inject_into_answer(kbinput, kbinput_len);
/* Empty the input buffer. */
kbinput_len = 0;
free(kbinput);
kbinput = NULL;
@ -176,8 +171,7 @@ int do_statusbar_input(bool *finished)
return input;
}
/* The user typed input_len multibyte characters. Add them to the answer,
* filtering out ASCII control characters if filtering is TRUE. */
/* The user typed input_len multibyte characters. Add them to the answer. */
void inject_into_answer(int *the_input, size_t input_len)
{
char *output = charalloc(input_len + 1);

View File

@ -3155,7 +3155,7 @@ void do_verbatim_input(void)
keycodes[i] = (char)kbinput[i];
keycodes[count] = '\0';
/* Insert the keystroke verbatim, without filtering control characters. */
/* Insert the keystroke verbatim. */
inject(keycodes, count);
free(keycodes);