input: ignore modifiers on a VT while executing a macro or a string bind
Any modifier keys that are needed to start the execution of a macro (or of a string bind) should not affect the interpretation of the keystrokes that are contained within the macro or the string. This fixes https://savannah.gnu.org/bugs/?57660. Bug existed since macros were introduced, in version 2.9.0.
Этот коммит содержится в:
родитель
a65f0ec80c
Коммит
fa686457c2
@ -40,8 +40,11 @@ bool meta_key;
|
|||||||
/* Whether the current keystroke is a Meta key. */
|
/* Whether the current keystroke is a Meta key. */
|
||||||
bool shift_held;
|
bool shift_held;
|
||||||
/* Whether Shift was being held together with a movement key. */
|
/* Whether Shift was being held together with a movement key. */
|
||||||
|
bool mute_modifiers = FALSE;
|
||||||
|
/* Whether to ignore modifier keys while running a macro or string bind. */
|
||||||
bool bracketed_paste = FALSE;
|
bool bracketed_paste = FALSE;
|
||||||
/* Whether text is being pasted into nano from outside. */
|
/* Whether text is being pasted into nano from outside. */
|
||||||
|
|
||||||
bool focusing = TRUE;
|
bool focusing = TRUE;
|
||||||
/* Whether an update of the edit window should center the cursor. */
|
/* Whether an update of the edit window should center the cursor. */
|
||||||
|
|
||||||
|
@ -2570,6 +2570,10 @@ int main(int argc, char **argv)
|
|||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
#ifdef ENABLE_LINENUMBERS
|
#ifdef ENABLE_LINENUMBERS
|
||||||
confirm_margin();
|
confirm_margin();
|
||||||
|
#endif
|
||||||
|
#ifdef __linux__
|
||||||
|
if (on_a_vt && get_key_buffer_len() == 0)
|
||||||
|
mute_modifiers = FALSE;
|
||||||
#endif
|
#endif
|
||||||
if (currmenu != MMAIN)
|
if (currmenu != MMAIN)
|
||||||
bottombars(MMAIN);
|
bottombars(MMAIN);
|
||||||
|
@ -31,6 +31,7 @@ extern bool shifted_metas;
|
|||||||
|
|
||||||
extern bool meta_key;
|
extern bool meta_key;
|
||||||
extern bool shift_held;
|
extern bool shift_held;
|
||||||
|
extern bool mute_modifiers;
|
||||||
extern bool bracketed_paste;
|
extern bool bracketed_paste;
|
||||||
|
|
||||||
extern bool focusing;
|
extern bool focusing;
|
||||||
|
@ -115,6 +115,8 @@ void run_macro(void)
|
|||||||
|
|
||||||
for (i = 0; i < macro_length; i++)
|
for (i = 0; i < macro_length; i++)
|
||||||
key_buffer[i] = macro_buffer[i];
|
key_buffer[i] = macro_buffer[i];
|
||||||
|
|
||||||
|
mute_modifiers = TRUE;
|
||||||
}
|
}
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
@ -284,6 +286,8 @@ void implant(const char *string)
|
|||||||
{
|
{
|
||||||
for (int i = strlen(string); i > 0; i--)
|
for (int i = strlen(string); i > 0; i--)
|
||||||
put_back((unsigned char)string[i - 1]);
|
put_back((unsigned char)string[i - 1]);
|
||||||
|
|
||||||
|
mute_modifiers = TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -586,7 +590,7 @@ int parse_kbinput(WINDOW *win)
|
|||||||
unsigned char modifiers = 6;
|
unsigned char modifiers = 6;
|
||||||
|
|
||||||
/* Modifiers are: Alt (8), Ctrl (4), Shift (1). */
|
/* Modifiers are: Alt (8), Ctrl (4), Shift (1). */
|
||||||
if (on_a_vt && ioctl(0, TIOCLINUX, &modifiers) >= 0) {
|
if (on_a_vt && !mute_modifiers && ioctl(0, TIOCLINUX, &modifiers) >= 0) {
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* Is Delete pressed together with Shift or Shift+Ctrl? */
|
/* Is Delete pressed together with Shift or Shift+Ctrl? */
|
||||||
if (retval == KEY_DC) {
|
if (retval == KEY_DC) {
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user