remove slang curses emulation support, as it's hopelessly broken, and it
doesn't make the binary very much smaller, especially when --enable-tiny is used git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4203 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
7f6f5a64fb
commit
c7fa5e1f9e
|
@ -1,5 +1,10 @@
|
||||||
2007-12-17 David Lawrence Ramsey <pooka109@gmail.com>
|
2007-12-17 David Lawrence Ramsey <pooka109@gmail.com>
|
||||||
|
|
||||||
|
* configure.ac, doc/texinfo/nano.texi, nano.c (version,
|
||||||
|
handle_sigwinch, terminal_init), winio.c (total_redraw): Remove
|
||||||
|
slang curses emulation support, as it's hopelessly broken, and
|
||||||
|
it doesn't make the binary very much smaller, especially when
|
||||||
|
--enable-tiny is used.
|
||||||
* nano.c (disable_signals, main): Simplify terminal handling by
|
* nano.c (disable_signals, main): Simplify terminal handling by
|
||||||
using raw mode instead of cbreak mode. This eliminates the need
|
using raw mode instead of cbreak mode. This eliminates the need
|
||||||
for disable_signals().
|
for disable_signals().
|
||||||
|
|
199
configure.ac
199
configure.ac
|
@ -185,193 +185,6 @@ fi],
|
||||||
[enable_utf8=auto])
|
[enable_utf8=auto])
|
||||||
AC_MSG_RESULT($enable_utf8)
|
AC_MSG_RESULT($enable_utf8)
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to use slang])
|
|
||||||
CURSES_LIB_NAME=""
|
|
||||||
AC_ARG_WITH(slang,
|
|
||||||
[ --with-slang[=DIR] Use the slang library instead of curses],
|
|
||||||
[ case "$with_slang" in
|
|
||||||
no)
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
|
|
||||||
if test x$with_slang != xyes; then
|
|
||||||
# Add additional search path
|
|
||||||
LDFLAGS="-L$with_slang/lib $LDFLAGS"
|
|
||||||
CPPFLAGS="-I$with_slang/include $CPPFLAGS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test x$enable_utf8 != xno; then
|
|
||||||
AC_CHECK_HEADER(slcurses.h,
|
|
||||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang])
|
|
||||||
_libs=$LIBS
|
|
||||||
LIBS="$LIBS -lslang"
|
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <slcurses.h>
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
SLutf8_enable(1);
|
|
||||||
return 0;
|
|
||||||
}],
|
|
||||||
[AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
|
|
||||||
CURSES_LIB_WIDE=yes
|
|
||||||
if test x$with_slang != xyes; then
|
|
||||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
|
||||||
else
|
|
||||||
CURSES_LIB="-lslang"
|
|
||||||
fi
|
|
||||||
CURSES_LIB_NAME=slang],
|
|
||||||
[AC_MSG_RESULT(no)
|
|
||||||
|
|
||||||
# We might need the term library
|
|
||||||
for termlib in ncurses curses termcap terminfo termlib; do
|
|
||||||
AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
|
|
||||||
test -n "$tcap" && break
|
|
||||||
done
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap])
|
|
||||||
LIBS="$LIBS $tcap"
|
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <slcurses.h>
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
SLutf8_enable(1);
|
|
||||||
return 0;
|
|
||||||
}],
|
|
||||||
[AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
|
|
||||||
CURSES_LIB_WIDE=yes
|
|
||||||
if test x$with_slang != xyes; then
|
|
||||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
|
||||||
else
|
|
||||||
CURSES_LIB="-lslang $tcap"
|
|
||||||
fi
|
|
||||||
CURSES_LIB_NAME=slang],
|
|
||||||
[AC_MSG_RESULT(no)
|
|
||||||
|
|
||||||
# We might need the math library
|
|
||||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap -lm])
|
|
||||||
LIBS="$LIBS -lm"
|
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <slcurses.h>
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
SLutf8_enable(1);
|
|
||||||
return 0;
|
|
||||||
}],
|
|
||||||
[AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
|
|
||||||
CURSES_LIB_WIDE=yes
|
|
||||||
if test x$with_slang != xyes; then
|
|
||||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
|
||||||
else
|
|
||||||
CURSES_LIB="-lslang $tcap -lm"
|
|
||||||
fi
|
|
||||||
CURSES_LIB_NAME=slang],
|
|
||||||
[AC_MSG_RESULT(no)],
|
|
||||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
|
||||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
|
||||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
|
||||||
AC_MSG_ERROR([
|
|
||||||
*** The header file slcurses.h was not found. If you wish to use
|
|
||||||
*** slang support this header file is required. Please either
|
|
||||||
*** install a version of slang that includes the slcurses.h file or
|
|
||||||
*** do not call the configure script with --with-slang.]))
|
|
||||||
fi
|
|
||||||
|
|
||||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
|
||||||
# Reset libs if the above slang tests failed
|
|
||||||
if test x$enable_utf8 != xno; then
|
|
||||||
LIBS=$_libs
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_CHECK_HEADER(slcurses.h,
|
|
||||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang])
|
|
||||||
_libs=$LIBS
|
|
||||||
LIBS="$LIBS -lslang"
|
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <slcurses.h>
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
SLtt_initialize(NULL);
|
|
||||||
return 0;
|
|
||||||
}],
|
|
||||||
[AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
|
|
||||||
if test x$with_slang != xyes; then
|
|
||||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
|
||||||
else
|
|
||||||
CURSES_LIB="-lslang"
|
|
||||||
fi
|
|
||||||
CURSES_LIB_NAME=slang],
|
|
||||||
[AC_MSG_RESULT(no)
|
|
||||||
|
|
||||||
# We might need the term library
|
|
||||||
for termlib in ncurses curses termcap terminfo termlib; do
|
|
||||||
AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
|
|
||||||
test -n "$tcap" && break
|
|
||||||
done
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
|
|
||||||
LIBS="$LIBS $tcap"
|
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <slcurses.h>
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
SLtt_initialize(NULL);
|
|
||||||
return 0;
|
|
||||||
}],
|
|
||||||
[AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
|
|
||||||
if test x$with_slang != xyes; then
|
|
||||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
|
||||||
else
|
|
||||||
CURSES_LIB="-lslang $tcap"
|
|
||||||
fi
|
|
||||||
CURSES_LIB_NAME=slang],
|
|
||||||
[AC_MSG_RESULT(no)
|
|
||||||
|
|
||||||
# We might need the math library
|
|
||||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
|
|
||||||
LIBS="$LIBS -lm"
|
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <slcurses.h>
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
SLtt_initialize(NULL);
|
|
||||||
return 0;
|
|
||||||
}],
|
|
||||||
[AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
|
|
||||||
if test x$with_slang != xyes; then
|
|
||||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
|
||||||
else
|
|
||||||
CURSES_LIB="-lslang $tcap -lm"
|
|
||||||
fi
|
|
||||||
CURSES_LIB_NAME=slang],
|
|
||||||
[AC_MSG_RESULT(no)],
|
|
||||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
|
||||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
|
||||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
|
||||||
AC_MSG_ERROR([
|
|
||||||
*** The header file slcurses.h was not found. If you wish to use
|
|
||||||
*** slang support this header file is required. Please either
|
|
||||||
*** install a version of slang that includes the slcurses.h file or
|
|
||||||
*** do not call the configure script with --with-slang.]))
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "${_libs+set}" = "set"; then
|
|
||||||
LIBS=$_libs
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test x$with_slang != xyes; then
|
|
||||||
LDFLAGS=${_ldflags}
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac], [AC_MSG_RESULT(no)])
|
|
||||||
|
|
||||||
AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes)
|
AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes)
|
||||||
AM_CONDITIONAL(USE_NANORC, test x$nanorc_support = xyes)
|
AM_CONDITIONAL(USE_NANORC, test x$nanorc_support = xyes)
|
||||||
|
|
||||||
|
@ -466,16 +279,14 @@ else
|
||||||
AC_MSG_ERROR([
|
AC_MSG_ERROR([
|
||||||
*** UTF-8 support was requested, but insufficient UTF-8 support was
|
*** UTF-8 support was requested, but insufficient UTF-8 support was
|
||||||
*** detected in your curses and/or C libraries. Please verify that your
|
*** detected in your curses and/or C libraries. Please verify that your
|
||||||
*** slang was built with UTF-8 support or your curses was built with
|
*** curses was built with wide character support, and that your C
|
||||||
*** wide character support, and that your C library was built with wide
|
*** library was built with wide character support.])
|
||||||
*** character support.])
|
|
||||||
elif test x$enable_utf8 != xno; then
|
elif test x$enable_utf8 != xno; then
|
||||||
AC_MSG_WARN([
|
AC_MSG_WARN([
|
||||||
*** Insufficient UTF-8 support was detected in your curses and/or C
|
*** Insufficient UTF-8 support was detected in your curses and/or C
|
||||||
*** libraries. If you want UTF-8 support, please verify that your slang
|
*** libraries. If you want UTF-8 support, please verify that your
|
||||||
*** was built with UTF-8 support or your curses was built with wide
|
*** curses was built with wide character support, and that your C
|
||||||
*** character support, and that your C library was built with wide
|
*** library was built with wide character support.])
|
||||||
*** character support.])
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
@smallbook
|
@smallbook
|
||||||
@set EDITION 0.1
|
@set EDITION 0.1
|
||||||
@set VERSION 2.0.0
|
@set VERSION 2.0.0
|
||||||
@set UPDATED 23 Aug 2007
|
@set UPDATED 17 Dec 2007
|
||||||
|
|
||||||
@dircategory Editors
|
@dircategory Editors
|
||||||
@direntry
|
@direntry
|
||||||
|
@ -842,15 +842,11 @@ Disable long line wrapping by default when nano is run as root.
|
||||||
|
|
||||||
@item --enable-utf8
|
@item --enable-utf8
|
||||||
Enable support for reading and writing Unicode files. This will require
|
Enable support for reading and writing Unicode files. This will require
|
||||||
either the wide version of ncurses, or a UTF-8-enabled version of Slang.
|
a wide version of curses.
|
||||||
|
|
||||||
@item --disable-utf8
|
@item --disable-utf8
|
||||||
Disable support for reading and writing Unicode files.
|
Disable support for reading and writing Unicode files.
|
||||||
|
|
||||||
@item --with-slang
|
|
||||||
Compiling @code{nano} with Slang is supported, and will make the binary
|
|
||||||
notably smaller than if compiled with ncurses or other curses libraries.
|
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@contents
|
@contents
|
||||||
|
|
43
src/nano.c
43
src/nano.c
|
@ -944,9 +944,6 @@ void version(void)
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
printf(" --enable-utf8");
|
printf(" --enable-utf8");
|
||||||
#endif
|
|
||||||
#ifdef USE_SLANG
|
|
||||||
printf(" --with-slang");
|
|
||||||
#endif
|
#endif
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
@ -1146,19 +1143,10 @@ RETSIGTYPE handle_sigwinch(int signal)
|
||||||
if (filepart != NULL)
|
if (filepart != NULL)
|
||||||
unpartition_filestruct(&filepart);
|
unpartition_filestruct(&filepart);
|
||||||
|
|
||||||
#ifdef USE_SLANG
|
|
||||||
/* Slang curses emulation brain damage, part 1: If we just do what
|
|
||||||
* curses does here, it'll only work properly if the resize made the
|
|
||||||
* window smaller. Do what mutt does: Leave and immediately reenter
|
|
||||||
* Slang screen management mode. */
|
|
||||||
SLsmg_reset_smg();
|
|
||||||
SLsmg_init_smg();
|
|
||||||
#else
|
|
||||||
/* Do the equivalent of what Minimum Profit does: Leave and
|
/* Do the equivalent of what Minimum Profit does: Leave and
|
||||||
* immediately reenter curses mode. */
|
* immediately reenter curses mode. */
|
||||||
endwin();
|
endwin();
|
||||||
doupdate();
|
doupdate();
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Restore the terminal to its previous state. */
|
/* Restore the terminal to its previous state. */
|
||||||
terminal_init();
|
terminal_init();
|
||||||
|
@ -1303,31 +1291,12 @@ void enable_flow_control(void)
|
||||||
* control characters. */
|
* control characters. */
|
||||||
void terminal_init(void)
|
void terminal_init(void)
|
||||||
{
|
{
|
||||||
#ifdef USE_SLANG
|
raw();
|
||||||
/* Slang curses emulation brain damage, part 2: Slang doesn't
|
nonl();
|
||||||
* implement nonl() or noecho() properly, so there's no way to
|
noecho();
|
||||||
* properly reinitialize the terminal using them. We have to save
|
disable_extended_io();
|
||||||
* the terminal state after the first call and restore it on
|
if (ISSET(PRESERVE))
|
||||||
* subsequent calls. */
|
enable_flow_control();
|
||||||
static struct termios newterm;
|
|
||||||
static bool newterm_set = FALSE;
|
|
||||||
|
|
||||||
if (!newterm_set) {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
raw();
|
|
||||||
nonl();
|
|
||||||
noecho();
|
|
||||||
disable_extended_io();
|
|
||||||
if (ISSET(PRESERVE))
|
|
||||||
enable_flow_control();
|
|
||||||
|
|
||||||
#ifdef USE_SLANG
|
|
||||||
tcgetattr(0, &newterm);
|
|
||||||
newterm_set = TRUE;
|
|
||||||
} else
|
|
||||||
tcsetattr(0, TCSANOW, &newterm);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read in a character, interpret it as a shortcut or toggle if
|
/* Read in a character, interpret it as a shortcut or toggle if
|
||||||
|
|
|
@ -61,15 +61,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_NCURSES_H)
|
#ifdef HAVE_NCURSES_H
|
||||||
#include <ncurses.h>
|
#include <ncurses.h>
|
||||||
#else
|
#else
|
||||||
/* Curses support. */
|
/* Curses support. */
|
||||||
|
|
|
@ -3167,14 +3167,7 @@ void edit_update(update_type location)
|
||||||
/* Unconditionally redraw the entire screen. */
|
/* Unconditionally redraw the entire screen. */
|
||||||
void total_redraw(void)
|
void total_redraw(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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unconditionally redraw the entire screen, and then refresh it using
|
/* Unconditionally redraw the entire screen, and then refresh it using
|
||||||
|
|
Loading…
Reference in New Issue