input: don't bother putting a keycode into byte range

A keycode is either already in byte range (so there is nothing to do)
or it is not and it shouldn't be (so there is nothing to do either).
master
Benno Schulenberg 2016-07-23 14:01:38 +02:00
parent 5b0ab8be62
commit 91951ab22a
4 changed files with 8 additions and 13 deletions

View File

@ -149,7 +149,7 @@ char *do_browser(char *path)
/* If we selected the same filename as last time, fake a
* press of the Enter key so that the file is read in. */
if (old_selected == selected)
unget_kbinput(sc_seq_or(do_enter, 0), FALSE, FALSE);
unget_kbinput(sc_seq_or(do_enter, 0), FALSE);
}
continue;

View File

@ -763,7 +763,7 @@ void dump_filestruct_reverse(void);
void get_key_buffer(WINDOW *win);
size_t get_key_buffer_len(void);
void unget_input(int *input, size_t input_len);
void unget_kbinput(int kbinput, bool metakey, bool funckey);
void unget_kbinput(int kbinput, bool metakey);
int *get_input(WINDOW *win, size_t input_len);
int get_kbinput(WINDOW *win);
int parse_kbinput(WINDOW *win);

View File

@ -2559,7 +2559,7 @@ void do_justify(bool full_justify)
}
} else {
/* Put the keystroke back into the queue. */
unget_kbinput(kbinput, meta_key, func_key);
unget_kbinput(kbinput, meta_key);
/* Set the desired screen column (always zero, except at EOF). */
openfile->placewewant = xplustabs();

View File

@ -248,15 +248,10 @@ void unget_input(int *input, size_t input_len)
memcpy(key_buffer, input, input_len * sizeof(int));
}
/* Put back the character stored in kbinput, putting it in byte range
* beforehand. If metakey is TRUE, put back the Escape character after
* putting back kbinput. If funckey is TRUE, put back the function key
* (a value outside byte range) without putting it in byte range. */
void unget_kbinput(int kbinput, bool metakey, bool funckey)
/* Put the character given in kbinput back into the input stream. If it
* is a Meta key, also insert an Escape character in front of it. */
void unget_kbinput(int kbinput, bool metakey)
{
if (!funckey)
kbinput = (char)kbinput;
unget_input(&kbinput, 1);
if (metakey) {
@ -1563,7 +1558,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
/* And put the corresponding key into the keyboard buffer. */
if (f != NULL) {
const sc *s = first_sc_for(currmenu, f->scfunc);
unget_kbinput(s->seq, s->type == META, s->type == DIRECT);
unget_kbinput(s->seq, s->type == META);
}
return 1;
} else
@ -1591,7 +1586,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
* wheel is equivalent to moving down three lines. */
for (i = 0; i < 3; i++)
unget_kbinput((mevent.bstate & BUTTON4_PRESSED) ?
KEY_PPAGE : KEY_NPAGE, FALSE, FALSE);
KEY_PPAGE : KEY_NPAGE, FALSE);
return 1;
} else