Commit 91951ab2 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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).
No related merge requests found
Showing with 8 additions and 13 deletions
+8 -13
...@@ -149,7 +149,7 @@ char *do_browser(char *path) ...@@ -149,7 +149,7 @@ char *do_browser(char *path)
/* If we selected the same filename as last time, fake a /* If we selected the same filename as last time, fake a
* press of the Enter key so that the file is read in. */ * press of the Enter key so that the file is read in. */
if (old_selected == selected) if (old_selected == selected)
unget_kbinput(sc_seq_or(do_enter, 0), FALSE, FALSE); unget_kbinput(sc_seq_or(do_enter, 0), FALSE);
} }
continue; continue;
......
...@@ -763,7 +763,7 @@ void dump_filestruct_reverse(void); ...@@ -763,7 +763,7 @@ void dump_filestruct_reverse(void);
void get_key_buffer(WINDOW *win); void get_key_buffer(WINDOW *win);
size_t get_key_buffer_len(void); size_t get_key_buffer_len(void);
void unget_input(int *input, size_t input_len); 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_input(WINDOW *win, size_t input_len);
int get_kbinput(WINDOW *win); int get_kbinput(WINDOW *win);
int parse_kbinput(WINDOW *win); int parse_kbinput(WINDOW *win);
......
...@@ -2559,7 +2559,7 @@ void do_justify(bool full_justify) ...@@ -2559,7 +2559,7 @@ void do_justify(bool full_justify)
} }
} else { } else {
/* Put the keystroke back into the queue. */ /* 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). */ /* Set the desired screen column (always zero, except at EOF). */
openfile->placewewant = xplustabs(); openfile->placewewant = xplustabs();
......
...@@ -248,15 +248,10 @@ void unget_input(int *input, size_t input_len) ...@@ -248,15 +248,10 @@ void unget_input(int *input, size_t input_len)
memcpy(key_buffer, input, input_len * sizeof(int)); memcpy(key_buffer, input, input_len * sizeof(int));
} }
/* Put back the character stored in kbinput, putting it in byte range /* Put the character given in kbinput back into the input stream. If it
* beforehand. If metakey is TRUE, put back the Escape character after * is a Meta key, also insert an Escape character in front of it. */
* putting back kbinput. If funckey is TRUE, put back the function key void unget_kbinput(int kbinput, bool metakey)
* (a value outside byte range) without putting it in byte range. */
void unget_kbinput(int kbinput, bool metakey, bool funckey)
{ {
if (!funckey)
kbinput = (char)kbinput;
unget_input(&kbinput, 1); unget_input(&kbinput, 1);
if (metakey) { if (metakey) {
...@@ -1563,7 +1558,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts) ...@@ -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. */ /* And put the corresponding key into the keyboard buffer. */
if (f != NULL) { if (f != NULL) {
const sc *s = first_sc_for(currmenu, f->scfunc); 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; return 1;
} else } else
...@@ -1591,7 +1586,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts) ...@@ -1591,7 +1586,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
* wheel is equivalent to moving down three lines. */ * wheel is equivalent to moving down three lines. */
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
unget_kbinput((mevent.bstate & BUTTON4_PRESSED) ? unget_kbinput((mevent.bstate & BUTTON4_PRESSED) ?
KEY_PPAGE : KEY_NPAGE, FALSE, FALSE); KEY_PPAGE : KEY_NPAGE, FALSE);
return 1; return 1;
} else } else
......
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