tweaks: rename a function, to make it not contain the name of another

Also, improve the names of its two parameters,
and make the tiny version a wee bit smaller.
master
Benno Schulenberg 2020-01-17 17:23:28 +01:00
parent 04e557fdaf
commit c4939c76a5
2 changed files with 8 additions and 7 deletions

View File

@ -607,7 +607,6 @@ linestruct *line_from_number(ssize_t lineno);
void record_macro(void); void record_macro(void);
void run_macro(void); void run_macro(void);
size_t get_key_buffer_len(void); size_t get_key_buffer_len(void);
void put_back(int keycode);
#ifdef ENABLE_NANORC #ifdef ENABLE_NANORC
void implant(const char *string); void implant(const char *string);
#endif #endif

View File

@ -278,15 +278,17 @@ void put_back(int keycode)
*key_buffer = keycode; *key_buffer = keycode;
} }
/* Put the character given in kbinput back into the input stream. If it #ifdef ENABLE_MOUSE
/* Insert the given keycode at the start of the keyboard buffer. If it
* is a Meta key, also insert an Escape character in front of it. */ * is a Meta key, also insert an Escape character in front of it. */
void unget_kbinput(int kbinput, bool metakey) void stuff_into_keybuffer(int keycode, bool is_metakey)
{ {
put_back(kbinput); put_back(keycode);
if (metakey) if (is_metakey)
put_back(ESC_CODE); put_back(ESC_CODE);
} }
#endif
#ifdef ENABLE_NANORC #ifdef ENABLE_NANORC
/* Insert the given string into the keyboard buffer. */ /* Insert the given string into the keyboard buffer. */
@ -1700,7 +1702,7 @@ int get_mouseinput(int *mouse_y, int *mouse_x, 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 keystruct *s = first_sc_for(currmenu, f->func); const keystruct *s = first_sc_for(currmenu, f->func);
unget_kbinput(s->keycode, s->meta); stuff_into_keybuffer(s->keycode, s->meta);
} }
return 1; return 1;
} else } else
@ -1721,7 +1723,7 @@ int get_mouseinput(int *mouse_y, int *mouse_x, bool allow_shortcuts)
if (in_edit || (in_bottomwin && *mouse_y == 0)) { if (in_edit || (in_bottomwin && *mouse_y == 0)) {
/* One roll of the mouse wheel should move three lines. */ /* One roll of the mouse wheel should move three lines. */
for (int count = 1; count <= 3; count++) for (int count = 1; count <= 3; count++)
unget_kbinput((mevent.bstate & BUTTON4_PRESSED) ? stuff_into_keybuffer((mevent.bstate & BUTTON4_PRESSED) ?
KEY_UP : KEY_DOWN, FALSE); KEY_UP : KEY_DOWN, FALSE);
return 1; return 1;
} else } else