aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--configure.ac20
-rw-r--r--src/interface-curses/interface-curses.cpp40
2 files changed, 41 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac
index 1bd446d..c710191 100644
--- a/configure.ac
+++ b/configure.ac
@@ -222,14 +222,14 @@ SCINTERM_PATH=`canonicalize $SCINTERM_PATH`
AC_SUBST(SCINTERM_PATH)
AC_ARG_WITH(interface,
- AS_HELP_STRING([--with-interface=ncurses|xcurses|pdcurses|gtk],
+ AS_HELP_STRING([--with-interface=ncurses|netbsd-curses|xcurses|pdcurses|gtk],
[Specify user interface [default=ncurses]]),
[INTERFACE=$withval], [INTERFACE=ncurses])
case $INTERFACE in
*curses)
case $INTERFACE in
- ncurses)
+ ncurses | netbsd-curses)
PKG_CHECK_MODULES(NCURSES, [ncurses], [
CFLAGS="$CFLAGS $NCURSES_CFLAGS"
CXXFLAGS="$CXXFLAGS $NCURSES_CFLAGS"
@@ -240,6 +240,14 @@ case $INTERFACE in
])
])
AC_CHECK_FUNCS([tigetstr])
+
+ if [[ x$INTERFACE = xnetbsd-curses ]]; then
+ # NetBSD's curses can act as a ncurses
+ # drop-in replacement and ships with a ncurses
+ # pkg-config file. Still we define a symbol since
+ # it's hard to detect at build-time.
+ AC_DEFINE(NETBSD_CURSES, 1, [Building against netbsd-curses])
+ fi
;;
xcurses)
@@ -271,7 +279,7 @@ case $INTERFACE in
LIBS="$LIBS $XCURSES_LIBS"
# This is also used by the curses.h itself:
- AC_DEFINE(XCURSES, , [Enable PDCurses/XCurses extensions])
+ AC_DEFINE(XCURSES, 1, [Enable PDCurses/XCurses extensions])
;;
pdcurses)
@@ -298,7 +306,7 @@ case $INTERFACE in
fi
AC_CHECK_FUNC([PDC_set_resize_limits], [
- AC_DEFINE(PDCURSES_WIN32A, , [PDCurses supports Win32a extensions])
+ AC_DEFINE(PDCURSES_WIN32A, 1, [PDCurses supports Win32a extensions])
])
;;
esac
@@ -306,7 +314,7 @@ case $INTERFACE in
AC_CHECK_HEADERS([curses.h], , [
AC_MSG_ERROR([Curses header missing!])
])
- AC_DEFINE(INTERFACE_CURSES, , [Build with curses support])
+ AC_DEFINE(INTERFACE_CURSES, 1, [Build with curses support])
# For Scintilla/Scinterm:
CPPFLAGS="$CPPFLAGS -DCURSES -I$SCINTERM_PATH"
@@ -329,7 +337,7 @@ gtk)
GOB2_CHECK(2.0.20)
- AC_DEFINE(INTERFACE_GTK, , [Build with GTK+ 3.0 support])
+ AC_DEFINE(INTERFACE_GTK, 1, [Build with GTK+ 3.0 support])
# For Scintilla:
CPPFLAGS="$CPPFLAGS -DGTK"
diff --git a/src/interface-curses/interface-curses.cpp b/src/interface-curses/interface-curses.cpp
index 43a53b8..96ce0d4 100644
--- a/src/interface-curses/interface-curses.cpp
+++ b/src/interface-curses/interface-curses.cpp
@@ -106,6 +106,14 @@
#endif
#endif
+#if defined(NCURSES_UNIX) || defined(NETBSD_CURSES)
+/**
+ * Whether Curses works on a real or pseudo TTY
+ * (ie. classic use with terminal emulators on Unix)
+ */
+#define CURSES_TTY
+#endif
+
namespace SciTECO {
extern "C" {
@@ -331,10 +339,10 @@ InterfaceCurses::init(void)
info_current = g_strdup(PACKAGE_NAME);
/*
- * On all platforms except NCurses/XTerm, it's
+ * On all platforms except Curses/XTerm, it's
* safe to initialize the clipboards now.
*/
-#ifndef NCURSES_UNIX
+#ifndef CURSES_TTY
init_clipboard();
#endif
}
@@ -381,7 +389,7 @@ InterfaceCurses::restore_colors(void)
}
}
-#elif defined(NCURSES_UNIX)
+#elif defined(CURSES_TTY)
/*
* FIXME: On UNIX/ncurses init_color_safe() __may__ change the
@@ -420,7 +428,7 @@ InterfaceCurses::restore_colors(void)
fflush(screen_tty);
}
-#else /* !PDCURSES_WIN32 && !NCURSES_UNIX */
+#else /* !PDCURSES_WIN32 && !CURSES_TTY */
void
InterfaceCurses::restore_colors(void)
@@ -469,7 +477,7 @@ InterfaceCurses::init_color(guint color, guint32 rgb)
}
}
-#ifdef NCURSES_UNIX
+#ifdef CURSES_TTY
void
InterfaceCurses::init_screen(void)
@@ -568,8 +576,10 @@ InterfaceCurses::init_interactive(void)
* NOTE: The only terminal emulator I'm aware of that lets
* us send an escape sequence for the escape key is Mintty
* (see "\e[?7727h").
+ *
+ * FIXME: This appears to be ineffective for netbsd-curses.
*/
-#ifdef NCURSES_UNIX
+#ifdef CURSES_TTY
if (!g_getenv("ESCDELAY"))
set_escdelay(25);
#endif
@@ -650,7 +660,7 @@ InterfaceCurses::init_interactive(void)
* emulator since clipboard operations will no longer interfer
* with stdout.
*/
-#ifdef NCURSES_UNIX
+#ifdef CURSES_TTY
init_clipboard();
#endif
}
@@ -665,7 +675,7 @@ InterfaceCurses::restore_batch(void)
* FIXME: See set_window_title() why this
* is necessary.
*/
-#if defined(NCURSES_UNIX) && defined(HAVE_TIGETSTR)
+#if defined(CURSES_TTY) && defined(HAVE_TIGETSTR)
set_window_title(g_getenv("TERM") ? : "");
#endif
@@ -680,7 +690,7 @@ InterfaceCurses::restore_batch(void)
* Restore stdout and stderr, so output goes to
* the terminal again in case we "muted" them.
*/
-#ifdef NCURSES_UNIX
+#ifdef CURSES_TTY
if (stdout_orig >= 0) {
int fd = dup2(stdout_orig, 1);
g_assert(fd == 1);
@@ -737,7 +747,7 @@ InterfaceCurses::vmsg_impl(MessageType type, const gchar *fmt, va_list ap)
* even in interactive mode.
*/
#if defined(XCURSES) || defined(PDCURSES_WIN32A) || \
- defined(NCURSES_UNIX) || defined(NCURSES_WIN32)
+ defined(CURSES_TTY) || defined(NCURSES_WIN32)
va_list aq;
va_copy(aq, ap);
stdio_vmsg(type, fmt, aq);
@@ -830,7 +840,7 @@ InterfaceCurses::set_window_title(const gchar *title)
last_title = g_strdup(title);
}
-#elif defined(NCURSES_UNIX) && defined(HAVE_TIGETSTR)
+#elif defined(CURSES_TTY) && defined(HAVE_TIGETSTR)
void
InterfaceCurses::set_window_title(const gchar *title)
@@ -1131,7 +1141,7 @@ InterfaceCurses::get_clipboard(const gchar *name, gsize *str_len)
return str;
}
-#elif defined(NCURSES_UNIX)
+#elif defined(CURSES_TTY)
void
InterfaceCurses::init_clipboard(void)
@@ -1325,7 +1335,7 @@ InterfaceCurses::get_clipboard(const gchar *name, gsize *str_len)
throw Error("Getting clipboard unsupported");
}
-#endif /* !__PDCURSES__ && !NCURSES_UNIX */
+#endif /* !__PDCURSES__ && !CURSES_TTY */
void
InterfaceCurses::popup_show_impl(void)
@@ -1401,6 +1411,10 @@ event_loop_iter()
* involved.
* On some Curses variants (XCurses) however, keypad
* must always be TRUE so we receive KEY_RESIZE.
+ *
+ * FIXME: NetBSD's curses could be handled like ncurses,
+ * but gets into an undefined state when SciTECO processes
+ * escape sequences.
*/
#ifdef NCURSES_UNIX
keypad(interface.cmdline_window, Flags::ed & Flags::ED_FNKEYS);