build: do not let Slang translate escape sequences to key codes
Slang fails to translate the longer sequences, and then truncates these sequences to just four bytes, effectively destroying them. Therefore, when built with --with-slang, always activate --raw-sequences. This avoids https://savannah.gnu.org/bugs/?49771. Bug was visible since version 2.5.0, since bindings for Ctrl+Left/Ctrl+Right were added.master
parent
3a22028042
commit
e12f397140
14
src/nano.c
14
src/nano.c
|
@ -430,11 +430,13 @@ void window_init(void)
|
||||||
/* In case the terminal shrunk, make sure the status line is clear. */
|
/* In case the terminal shrunk, make sure the status line is clear. */
|
||||||
wipe_statusbar();
|
wipe_statusbar();
|
||||||
|
|
||||||
|
#ifndef USE_SLANG
|
||||||
/* When not disabled, turn escape-sequence translation on. */
|
/* When not disabled, turn escape-sequence translation on. */
|
||||||
if (!ISSET(RAW_SEQUENCES)) {
|
if (!ISSET(RAW_SEQUENCES)) {
|
||||||
keypad(edit, TRUE);
|
keypad(edit, TRUE);
|
||||||
keypad(bottomwin, TRUE);
|
keypad(bottomwin, TRUE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLED_WRAPORJUSTIFY
|
#ifdef ENABLED_WRAPORJUSTIFY
|
||||||
/* Set up the wrapping point, accounting for screen width when negative. */
|
/* Set up the wrapping point, accounting for screen width when negative. */
|
||||||
|
@ -534,8 +536,10 @@ void usage(void)
|
||||||
print_opt(_("-J <number>"), _("--guidestripe=<number>"),
|
print_opt(_("-J <number>"), _("--guidestripe=<number>"),
|
||||||
N_("Show a guiding bar at this column"));
|
N_("Show a guiding bar at this column"));
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef USE_SLANG
|
||||||
print_opt("-K", "--rawsequences",
|
print_opt("-K", "--rawsequences",
|
||||||
N_("Fix numeric keypad key confusion problem"));
|
N_("Fix numeric keypad key confusion problem"));
|
||||||
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
print_opt("-L", "--nonewlines",
|
print_opt("-L", "--nonewlines",
|
||||||
N_("Don't add an automatic newline"));
|
N_("Don't add an automatic newline"));
|
||||||
|
@ -1690,7 +1694,9 @@ int main(int argc, char **argv)
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
{"ignorercfiles", 0, NULL, 'I'},
|
{"ignorercfiles", 0, NULL, 'I'},
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef USE_SLANG
|
||||||
{"rawsequences", 0, NULL, 'K'},
|
{"rawsequences", 0, NULL, 'K'},
|
||||||
|
#endif
|
||||||
#ifdef ENABLED_WRAPORJUSTIFY
|
#ifdef ENABLED_WRAPORJUSTIFY
|
||||||
{"trimblanks", 0, NULL, 'M'},
|
{"trimblanks", 0, NULL, 'M'},
|
||||||
#endif
|
#endif
|
||||||
|
@ -1871,9 +1877,11 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef USE_SLANG
|
||||||
case 'K':
|
case 'K':
|
||||||
SET(RAW_SEQUENCES);
|
SET(RAW_SEQUENCES);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
case 'L':
|
case 'L':
|
||||||
SET(NO_NEWLINES);
|
SET(NO_NEWLINES);
|
||||||
|
@ -2192,9 +2200,15 @@ int main(int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_SLANG
|
||||||
|
/* When using Slang, do not let Slang translate escape sequences to
|
||||||
|
* key codes, because it does it wrong for the longer sequences. */
|
||||||
|
SET(RAW_SEQUENCES);
|
||||||
|
#else
|
||||||
/* When getting untranslated escape sequences, the mouse cannot be used. */
|
/* When getting untranslated escape sequences, the mouse cannot be used. */
|
||||||
if (ISSET(RAW_SEQUENCES))
|
if (ISSET(RAW_SEQUENCES))
|
||||||
UNSET(USE_MOUSE);
|
UNSET(USE_MOUSE);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
/* Initialize the pointers for the Search/Replace/Execute histories. */
|
/* Initialize the pointers for the Search/Replace/Execute histories. */
|
||||||
|
|
|
@ -1447,9 +1447,10 @@ char *get_verbatim_kbinput(WINDOW *win, size_t *count)
|
||||||
* don't get extended keypad values. */
|
* don't get extended keypad values. */
|
||||||
if (ISSET(PRESERVE))
|
if (ISSET(PRESERVE))
|
||||||
disable_flow_control();
|
disable_flow_control();
|
||||||
|
#ifndef USE_SLANG
|
||||||
if (!ISSET(RAW_SEQUENCES))
|
if (!ISSET(RAW_SEQUENCES))
|
||||||
keypad(win, FALSE);
|
keypad(win, FALSE);
|
||||||
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* Turn bracketed-paste mode off. */
|
/* Turn bracketed-paste mode off. */
|
||||||
printf("\x1B[?2004l");
|
printf("\x1B[?2004l");
|
||||||
|
@ -1483,12 +1484,14 @@ char *get_verbatim_kbinput(WINDOW *win, size_t *count)
|
||||||
* keypad back on if necessary now that we're done. */
|
* keypad back on if necessary now that we're done. */
|
||||||
if (ISSET(PRESERVE))
|
if (ISSET(PRESERVE))
|
||||||
enable_flow_control();
|
enable_flow_control();
|
||||||
|
#ifndef USE_SLANG
|
||||||
/* Use the global window pointers, because a resize may have freed
|
/* Use the global window pointers, because a resize may have freed
|
||||||
* the data that the win parameter points to. */
|
* the data that the win parameter points to. */
|
||||||
if (!ISSET(RAW_SEQUENCES)) {
|
if (!ISSET(RAW_SEQUENCES)) {
|
||||||
keypad(edit, TRUE);
|
keypad(edit, TRUE);
|
||||||
keypad(bottomwin, TRUE);
|
keypad(bottomwin, TRUE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (*count < 999) {
|
if (*count < 999) {
|
||||||
for (size_t i = 0; i < *count; i++)
|
for (size_t i = 0; i < *count; i++)
|
||||||
|
|
Loading…
Reference in New Issue