6 Commits
0.2.3 ... 0.3.0

Author SHA1 Message Date
Joachim Nilsson
5b27b6ce4f src/editline.c:
tty_flush(): Silence compiler warning.

        meta(): Extend to support Home, End and Del keys, in addition to
        the arrow keys. Also capturing PgUp, PgDn and Ins to prevent
        them from generating odd ~ characters in input.

        Also rearranged a couple of callback functions so they could be
        reached by the meta() function without forward declaring them.
        This is also better placement, together with other similar fns.
2009-02-08 22:09:02 +01:00
Joachim Nilsson
e828182cb0 Bump version to 0.3.0, ANSI arrow keys support
feels like a big deal.
2009-02-08 21:21:08 +01:00
Joachim Nilsson
c1b3d17926 Update TODO and add a NEWS file. 2009-02-08 21:19:38 +01:00
Joachim Nilsson
69e01d11d4 config.h.in, configure, configure.ac:
Add configure support for ANSI arrow keys.
        Tested OK with gnome-terminal.

src/complete.c:
	Remove usage of CONST and refactor compare() to use standard
        C syntax instead of old K&R.
2009-02-08 21:13:54 +01:00
Joachim Nilsson
4898413730 Fix GCC warning 's might possibly be used uninitialized" 2009-02-08 20:19:58 +01:00
Joachim Nilsson
b1e74f3de2 Updated ignored files. 2008-12-02 22:06:58 +01:00
9 changed files with 115 additions and 59 deletions

16
.bzrignore Normal file
View File

@@ -0,0 +1,16 @@
Makefile
archive
autom4te.cache
config.h
config.log
config.status
stamp-h1
examples/.deps
examples/Makefile
examples/cli
examples/testit
man/Makefile
man/Makefile
include/Makefile
src/.deps
src/Makefile

View File

@@ -32,7 +32,7 @@ POST_UNINSTALL = :
subdir = . subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure TODO depcomp install-sh missing $(top_srcdir)/configure NEWS TODO depcomp install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \

9
NEWS Normal file
View File

@@ -0,0 +1,9 @@
Notable Changes
* v0.3.0
** Support for ANSI arrow keys using --enable-arrow-keys
* v0.2.x
** Patches from Debian package merged.
** Support for custom command completion.

9
TODO
View File

@@ -1,14 +1,5 @@
TODO TODO
* Merge in useful patches from Debian package
* Add --enable-FEATURE for features defined in Makefile-minix.in * Add --enable-FEATURE for features defined in Makefile-minix.in
* Add support for custom completion, rl_attempted_completion_function.
* Add support for inhibiting completion: rl_inhibit_completion * Add support for inhibiting completion: rl_inhibit_completion
* Add support for arrow keys, home, end, etc. See the following URL
for how to catch complex key strokes such as escape sequences:
http://www.unixwiz.net/techtips/termios-vmin-vtime.html

View File

@@ -1,5 +1,8 @@
/* config.h.in. Generated from configure.ac by autoheader. */ /* config.h.in. Generated from configure.ac by autoheader. */
/* Define to include ANSI arrow keys support in minix-editline */
#undef ANSI_ARROWS
/* Define to 1 if the `closedir' function returns void instead of `int'. */ /* Define to 1 if the `closedir' function returns void instead of `int'. */
#undef CLOSEDIR_VOID #undef CLOSEDIR_VOID

39
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for Minix editline 0.2.3. # Generated by GNU Autoconf 2.61 for Minix editline 0.3.0.
# #
# Report bugs to <joachim@vmlinux.org>. # Report bugs to <joachim@vmlinux.org>.
# #
@@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package. # Identity of this package.
PACKAGE_NAME='Minix editline' PACKAGE_NAME='Minix editline'
PACKAGE_TARNAME='minix-editline' PACKAGE_TARNAME='minix-editline'
PACKAGE_VERSION='0.2.3' PACKAGE_VERSION='0.3.0'
PACKAGE_STRING='Minix editline 0.2.3' PACKAGE_STRING='Minix editline 0.3.0'
PACKAGE_BUGREPORT='joachim@vmlinux.org' PACKAGE_BUGREPORT='joachim@vmlinux.org'
ac_unique_file="src/editline.c" ac_unique_file="src/editline.c"
@@ -1210,7 +1210,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures Minix editline 0.2.3 to adapt to many kinds of systems. \`configure' configures Minix editline 0.3.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1276,7 +1276,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of Minix editline 0.2.3:";; short | recursive ) echo "Configuration of Minix editline 0.3.0:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@@ -1286,6 +1286,7 @@ Optional Features:
--disable-dependency-tracking speeds up one-time build --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors --enable-dependency-tracking do not reject slow dependency extractors
--enable-default-complete Enable default completion handler. --enable-default-complete Enable default completion handler.
--enable-arrow-keys Enable ANSI arrow keys.
Some influential environment variables: Some influential environment variables:
CC C compiler command CC C compiler command
@@ -1361,7 +1362,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
Minix editline configure 0.2.3 Minix editline configure 0.3.0
generated by GNU Autoconf 2.61 generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1375,7 +1376,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by Minix editline $as_me 0.2.3, which was It was created by Minix editline $as_me 0.3.0, which was
generated by GNU Autoconf 2.61. Invocation command line was generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@ $ $0 $@
@@ -2070,7 +2071,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='minix-editline' PACKAGE='minix-editline'
VERSION='0.2.3' VERSION='0.3.0'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@@ -5003,6 +5004,23 @@ else
fi fi
ac_enable_arrow_keys=no
# Check whether --enable-arrow-keys was given.
if test "${enable_arrow_keys+set}" = set; then
enableval=$enable_arrow_keys; ac_enable_arrow_keys=$enableval
else
ac_enable_arrow_keys=no
fi
if test "x${ac_enable_arrow_keys}" = xyes ; then
cat >>confdefs.h <<\_ACEOF
#define ANSI_ARROWS
_ACEOF
fi
ac_config_files="$ac_config_files Makefile src/Makefile include/Makefile man/Makefile examples/Makefile" ac_config_files="$ac_config_files Makefile src/Makefile include/Makefile man/Makefile examples/Makefile"
cat >confcache <<\_ACEOF cat >confcache <<\_ACEOF
@@ -5422,7 +5440,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by Minix editline $as_me 0.2.3, which was This file was extended by Minix editline $as_me 0.3.0, which was
generated by GNU Autoconf 2.61. Invocation command line was generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@@ -5475,7 +5493,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\ ac_cs_version="\\
Minix editline config.status 0.2.3 Minix editline config.status 0.3.0
configured by $0, generated by GNU Autoconf 2.61, configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
@@ -6342,3 +6360,4 @@ if test "$no_create" != yes; then
$ac_cs_success || { (exit 1); exit 1; } $ac_cs_success || { (exit 1); exit 1; }
fi fi

View File

@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61) AC_PREREQ(2.61)
AC_INIT(Minix editline, 0.2.3, joachim@vmlinux.org) AC_INIT(Minix editline, 0.3.0, joachim@vmlinux.org)
AC_CONFIG_SRCDIR([src/editline.c]) AC_CONFIG_SRCDIR([src/editline.c])
AC_CONFIG_HEADER([config.h]) AC_CONFIG_HEADER([config.h])
@@ -55,4 +55,15 @@ AC_ARG_ENABLE([default-complete],
esac],[complete=false]) esac],[complete=false])
AM_CONDITIONAL([COMPLETE], [test x$complete = xtrue]) AM_CONDITIONAL([COMPLETE], [test x$complete = xtrue])
ac_enable_arrow_keys=no
AC_ARG_ENABLE(arrow-keys,
[ --enable-arrow-keys Enable ANSI arrow keys.],
[ ac_enable_arrow_keys=$enableval ], [ ac_enable_arrow_keys=no])
if test "x${ac_enable_arrow_keys}" = xyes ; then
AC_DEFINE([ANSI_ARROWS], [],
[Define to include ANSI arrow keys support in minix-editline])
fi
AC_OUTPUT(Makefile src/Makefile include/Makefile man/Makefile examples/Makefile) AC_OUTPUT(Makefile src/Makefile include/Makefile man/Makefile examples/Makefile)

View File

@@ -25,15 +25,11 @@ strdup(p)
** strcmp-like sorting predicate for qsort. ** strcmp-like sorting predicate for qsort.
*/ */
static int static int
compare(p1, p2) compare(void *p1, void *p2)
CONST void *p1;
CONST void *p2;
{ {
CONST char **v1; char **v1 = (char **)p1;
CONST char **v2; char **v2 = (char **)p2;
v1 = (CONST char **)p1;
v2 = (CONST char **)p2;
return strcmp(*v1, *v2); return strcmp(*v1, *v2);
} }

View File

@@ -120,8 +120,10 @@ extern int tgetnum(void);
static void tty_flush(void) static void tty_flush(void)
{ {
ssize_t res;
if (ScreenCount) { if (ScreenCount) {
(void)write(1, Screen, ScreenCount); res = write (1, Screen, ScreenCount);
ScreenCount = 0; ScreenCount = 0;
} }
} }
@@ -764,6 +766,29 @@ static el_status_t insert_char(int c)
return s; return s;
} }
static el_status_t beg_line(void)
{
if (Point) {
Point = 0;
return CSmove;
}
return CSstay;
}
static el_status_t end_line(void)
{
if (Point != End) {
Point = End;
return CSmove;
}
return CSstay;
}
static el_status_t del_char(void)
{
return delete_string(Repeat == NO_ARG ? 1 : Repeat);
}
static el_status_t meta(void) static el_status_t meta(void)
{ {
int c; int c;
@@ -773,14 +798,23 @@ static el_status_t meta(void)
return CSeof; return CSeof;
#if defined(ANSI_ARROWS) #if defined(ANSI_ARROWS)
/* Also include VT-100 arrows. */ /* Also include VT-100 arrows. */
if (c == '[' || c == 'O') if (c == '[' || c == 'O') {
switch (c = tty_get()) { c = tty_get();
// printf ("E[%c\n", c);
switch (c) {
default: return ring_bell(); default: return ring_bell();
case EOF: return CSeof; case EOF: return CSeof;
case 'A': return h_prev(); case '2': tty_get(); return CSstay; /* Insert */
case 'B': return h_next(); case '3': tty_get(); return del_char(); /* Delete */
case 'C': return fd_char(); case '5': tty_get(); return CSstay; /* PgUp */
case 'D': return bk_char(); case '6': tty_get(); return CSstay; /* PgDn */
case 'A': return h_prev(); /* Up */
case 'B': return h_next(); /* Down */
case 'C': return fd_char(); /* Left */
case 'D': return bk_char(); /* Right */
case 'F': return end_line(); /* End */
case 'H': return beg_line(); /* Home */
}
} }
#endif /* defined(ANSI_ARROWS) */ #endif /* defined(ANSI_ARROWS) */
@@ -1047,29 +1081,6 @@ void add_history(char *p __attribute__ ((unused)))
} }
static el_status_t beg_line(void)
{
if (Point) {
Point = 0;
return CSmove;
}
return CSstay;
}
static el_status_t del_char(void)
{
return delete_string(Repeat == NO_ARG ? 1 : Repeat);
}
static el_status_t end_line(void)
{
if (Point != End) {
Point = End;
return CSmove;
}
return CSstay;
}
/* /*
** Move back to the beginning of the current word and return an ** Move back to the beginning of the current word and return an
** allocated copy of it. ** allocated copy of it.
@@ -1136,7 +1147,7 @@ static el_status_t c_complete(void)
char *word, *new; char *word, *new;
SIZE_T len; SIZE_T len;
int unique; int unique;
el_status_t s; el_status_t s = 0;
if (!rl_complete) { if (!rl_complete) {
return ring_bell(); return ring_bell();