general: remove support for Slang
Slang has too many bugs to be useful. This addresses https://savannah.gnu.org/bugs/?59210.master
parent
2157738a18
commit
4f7593b704
|
@ -68,15 +68,8 @@
|
||||||
#define PATH_MAX 4096
|
#define PATH_MAX 4096
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_SLANG
|
|
||||||
/* Slang support. */
|
|
||||||
#include <slcurses.h>
|
|
||||||
/* Slang curses emulation brain damage, part 3: Slang doesn't define the
|
|
||||||
* curses equivalents of the Insert or Delete keys. */
|
|
||||||
#define KEY_DC SL_KEY_DELETE
|
|
||||||
#define KEY_IC SL_KEY_IC
|
|
||||||
/* Ncurses support. */
|
/* Ncurses support. */
|
||||||
#elif defined(HAVE_NCURSESW_NCURSES_H)
|
#if defined(HAVE_NCURSESW_NCURSES_H)
|
||||||
#include <ncursesw/ncurses.h>
|
#include <ncursesw/ncurses.h>
|
||||||
#elif defined(HAVE_NCURSES_H)
|
#elif defined(HAVE_NCURSES_H)
|
||||||
#include <ncurses.h>
|
#include <ncurses.h>
|
||||||
|
@ -615,11 +608,7 @@ enum
|
||||||
/* A special keycode for when a key produces an unknown escape sequence. */
|
/* A special keycode for when a key produces an unknown escape sequence. */
|
||||||
#define FOREIGN_SEQUENCE 0x4FC
|
#define FOREIGN_SEQUENCE 0x4FC
|
||||||
|
|
||||||
#ifdef USE_SLANG
|
|
||||||
#define KEY_FLUSH 0xFF /* Clipped error code. */
|
|
||||||
#else
|
|
||||||
#define KEY_FLUSH KEY_F0 /* Nonexistent function key. */
|
#define KEY_FLUSH KEY_F0 /* Nonexistent function key. */
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* An imaginary key for when we get a SIGWINCH (window resize). */
|
/* An imaginary key for when we get a SIGWINCH (window resize). */
|
||||||
|
|
60
src/nano.c
60
src/nano.c
|
@ -62,10 +62,6 @@ static struct termios original_state;
|
||||||
|
|
||||||
static struct sigaction oldaction, newaction;
|
static struct sigaction oldaction, newaction;
|
||||||
/* Containers for the original and the temporary handler for SIGINT. */
|
/* Containers for the original and the temporary handler for SIGINT. */
|
||||||
#ifdef USE_SLANG
|
|
||||||
static bool selfinduced = FALSE;
|
|
||||||
/* Whether a suspension was caused from inside nano or from outside. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Create a new linestruct node. Note that we do not set prevnode->next. */
|
/* Create a new linestruct node. Note that we do not set prevnode->next. */
|
||||||
linestruct *make_new_node(linestruct *prevnode)
|
linestruct *make_new_node(linestruct *prevnode)
|
||||||
|
@ -422,13 +418,11 @@ 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. */
|
||||||
|
@ -526,10 +520,8 @@ 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"));
|
||||||
|
@ -775,9 +767,6 @@ void version(void)
|
||||||
printf(" --enable-utf8");
|
printf(" --enable-utf8");
|
||||||
#else
|
#else
|
||||||
printf(" --disable-utf8");
|
printf(" --disable-utf8");
|
||||||
#endif
|
|
||||||
#ifdef USE_SLANG
|
|
||||||
printf(" --with-slang");
|
|
||||||
#endif
|
#endif
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
@ -957,13 +946,7 @@ void do_suspend(int signal)
|
||||||
void do_suspend_void(void)
|
void do_suspend_void(void)
|
||||||
{
|
{
|
||||||
if (ISSET(SUSPENDABLE)) {
|
if (ISSET(SUSPENDABLE)) {
|
||||||
#ifdef USE_SLANG
|
|
||||||
selfinduced = TRUE;
|
|
||||||
do_suspend(0);
|
do_suspend(0);
|
||||||
selfinduced = FALSE;
|
|
||||||
#else
|
|
||||||
do_suspend(0);
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
statusbar(_("Suspension is not enabled"));
|
statusbar(_("Suspension is not enabled"));
|
||||||
beep();
|
beep();
|
||||||
|
@ -987,13 +970,9 @@ void do_continue(int signal)
|
||||||
/* Put the terminal in the desired state again. */
|
/* Put the terminal in the desired state again. */
|
||||||
terminal_init();
|
terminal_init();
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_SLANG
|
|
||||||
if (!selfinduced)
|
|
||||||
full_refresh();
|
|
||||||
#else
|
|
||||||
/* Insert a fake keystroke, to neutralize a key-eating issue. */
|
/* Insert a fake keystroke, to neutralize a key-eating issue. */
|
||||||
ungetch(KEY_FLUSH);
|
ungetch(KEY_FLUSH);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(NANO_TINY) || defined(ENABLE_SPELLER) || defined(ENABLE_COLOR)
|
#if !defined(NANO_TINY) || defined(ENABLE_SPELLER) || defined(ENABLE_COLOR)
|
||||||
|
@ -1202,36 +1181,14 @@ void enable_flow_control(void)
|
||||||
* control characters. */
|
* control characters. */
|
||||||
void terminal_init(void)
|
void terminal_init(void)
|
||||||
{
|
{
|
||||||
#ifdef USE_SLANG
|
|
||||||
/* Slang curses emulation brain damage, part 2: Slang doesn't
|
|
||||||
* implement raw(), nonl(), or noecho() properly, so there's no way
|
|
||||||
* to properly reinitialize the terminal using them. We have to
|
|
||||||
* disable the special control keys and interpretation of the flow
|
|
||||||
* control characters using termios, save the terminal state after
|
|
||||||
* the first call, and restore it on subsequent calls. */
|
|
||||||
static struct termios desired_state;
|
|
||||||
static bool have_new_state = FALSE;
|
|
||||||
|
|
||||||
if (!have_new_state) {
|
|
||||||
#endif
|
|
||||||
raw();
|
raw();
|
||||||
nonl();
|
nonl();
|
||||||
noecho();
|
noecho();
|
||||||
disable_extended_io();
|
disable_extended_io();
|
||||||
#ifdef USE_SLANG
|
|
||||||
tcgetattr(0, &desired_state);
|
|
||||||
have_new_state = TRUE;
|
|
||||||
} else
|
|
||||||
tcsetattr(0, TCSANOW, &desired_state);
|
|
||||||
|
|
||||||
SLang_init_tty(-1, 0, 0);
|
|
||||||
#endif
|
|
||||||
if (ISSET(PRESERVE))
|
if (ISSET(PRESERVE))
|
||||||
enable_flow_control();
|
enable_flow_control();
|
||||||
#ifdef USE_SLANG
|
|
||||||
else
|
|
||||||
disable_flow_control();
|
|
||||||
#endif
|
|
||||||
disable_kb_interrupt();
|
disable_kb_interrupt();
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
@ -1711,9 +1668,7 @@ 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
|
||||||
|
@ -1816,9 +1771,6 @@ int main(int argc, char **argv)
|
||||||
* to use the multibyte functions for text processing. */
|
* to use the multibyte functions for text processing. */
|
||||||
if (setlocale(LC_ALL, "") != NULL &&
|
if (setlocale(LC_ALL, "") != NULL &&
|
||||||
strcmp(nl_langinfo(CODESET), "UTF-8") == 0) {
|
strcmp(nl_langinfo(CODESET), "UTF-8") == 0) {
|
||||||
#ifdef USE_SLANG
|
|
||||||
SLutf8_enable(1);
|
|
||||||
#endif
|
|
||||||
utf8_init();
|
utf8_init();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -1898,11 +1850,9 @@ 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);
|
||||||
|
@ -2233,15 +2183,9 @@ 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. */
|
||||||
|
|
36
src/winio.c
36
src/winio.c
|
@ -180,9 +180,6 @@ void read_keys_from(WINDOW *win)
|
||||||
|
|
||||||
if (reveal_cursor) {
|
if (reveal_cursor) {
|
||||||
curs_set(1);
|
curs_set(1);
|
||||||
#ifdef USE_SLANG
|
|
||||||
doupdate();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read in the first keycode, waiting for it to arrive. */
|
/* Read in the first keycode, waiting for it to arrive. */
|
||||||
|
@ -570,11 +567,6 @@ int convert_CSI_sequence(const int *seq, size_t length, int *consumed)
|
||||||
} else if (length > 4 && seq[2] == ';' && seq[4] == '~')
|
} else if (length > 4 && seq[2] == ';' && seq[4] == '~')
|
||||||
/* Esc [ 1 n ; 2 ~ == F17...F20 on some terminals. */
|
/* Esc [ 1 n ; 2 ~ == F17...F20 on some terminals. */
|
||||||
*consumed = 5;
|
*consumed = 5;
|
||||||
#ifdef USE_SLANG
|
|
||||||
else if (length == 3 && seq[2] == ';')
|
|
||||||
/* Discard broken sequences that Slang produces. */
|
|
||||||
*consumed = 3;
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
if (length > 2 && seq[2] == '~') {
|
if (length > 2 && seq[2] == '~') {
|
||||||
|
@ -605,11 +597,6 @@ int convert_CSI_sequence(const int *seq, size_t length, int *consumed)
|
||||||
else if (length > 4 && seq[2] == ';' && seq[4] == '~')
|
else if (length > 4 && seq[2] == ';' && seq[4] == '~')
|
||||||
/* Esc [ 2 n ; 2 ~ == F21...F24 on some terminals. */
|
/* Esc [ 2 n ; 2 ~ == F21...F24 on some terminals. */
|
||||||
*consumed = 5;
|
*consumed = 5;
|
||||||
#ifdef USE_SLANG
|
|
||||||
else if (length == 3 && seq[2] == ';')
|
|
||||||
/* Discard broken sequences that Slang produces. */
|
|
||||||
*consumed = 3;
|
|
||||||
#endif
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
else if (length > 3 && seq[1] == '0' && seq[3] == '~') {
|
else if (length > 3 && seq[1] == '0' && seq[3] == '~') {
|
||||||
/* Esc [ 2 0 0 ~ == start of a bracketed paste,
|
/* Esc [ 2 0 0 ~ == start of a bracketed paste,
|
||||||
|
@ -1447,10 +1434,9 @@ 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");
|
||||||
|
@ -1484,14 +1470,13 @@ 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++)
|
||||||
|
@ -2152,11 +2137,6 @@ void statusline(message_type importance, const char *msg, ...)
|
||||||
statusblank = 1;
|
statusblank = 1;
|
||||||
else
|
else
|
||||||
statusblank = 26;
|
statusblank = 26;
|
||||||
|
|
||||||
#ifdef USE_SLANG
|
|
||||||
/* Work around a shy cursor -- https://sv.gnu.org/bugs/?59091. */
|
|
||||||
bottombars(MGOTODIR);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display a normal message on the status bar, quietly. */
|
/* Display a normal message on the status bar, quietly. */
|
||||||
|
@ -3284,14 +3264,7 @@ void adjust_viewport(update_type manner)
|
||||||
/* Tell curses to unconditionally redraw whatever was on the screen. */
|
/* Tell curses to unconditionally redraw whatever was on the screen. */
|
||||||
void full_refresh(void)
|
void full_refresh(void)
|
||||||
{
|
{
|
||||||
#ifdef USE_SLANG
|
|
||||||
/* Slang curses emulation brain damage, part 4: Slang doesn't define
|
|
||||||
* curscr. */
|
|
||||||
SLsmg_touch_screen();
|
|
||||||
SLsmg_refresh();
|
|
||||||
#else
|
|
||||||
wrefresh(curscr);
|
wrefresh(curscr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw all elements of the screen. That is: the title bar plus the content
|
/* Draw all elements of the screen. That is: the title bar plus the content
|
||||||
|
@ -3337,11 +3310,6 @@ void report_cursor_position(void)
|
||||||
_("line %zd/%zd (%d%%), col %zu/%zu (%d%%), char %zu/%zu (%d%%)"),
|
_("line %zd/%zd (%d%%), col %zu/%zu (%d%%), char %zu/%zu (%d%%)"),
|
||||||
openfile->current->lineno, openfile->filebot->lineno, linepct,
|
openfile->current->lineno, openfile->filebot->lineno, linepct,
|
||||||
column, fullwidth, colpct, sum, openfile->totsize, charpct);
|
column, fullwidth, colpct, sum, openfile->totsize, charpct);
|
||||||
|
|
||||||
#ifdef USE_SLANG
|
|
||||||
/* Restore the help lines after the above call overwrote them. */
|
|
||||||
bottombars(MMAIN);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Highlight the text between the given two columns on the current line. */
|
/* Highlight the text between the given two columns on the current line. */
|
||||||
|
|
Loading…
Reference in New Issue