Make scrollback history (HIST_SIZE) configurable

This commit is contained in:
Joachim Nilsson 2010-07-18 05:19:03 +02:00
parent 7d0aff5ba3
commit 4c4a7e808c
10 changed files with 55 additions and 18 deletions

View File

@ -137,6 +137,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@ EXEEXT = @EXEEXT@
FGREP = @FGREP@ FGREP = @FGREP@
GREP = @GREP@ GREP = @GREP@
HIST_SIZE = @HIST_SIZE@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_PROGRAM = @INSTALL_PROGRAM@

1
TODO
View File

@ -2,6 +2,7 @@ TODO
* Port "fileman" example from BSD editline * Port "fileman" example from BSD editline
* Add --enable-FEATURE for remaining features defined in Makefile-minix.in * Add --enable-FEATURE for remaining features defined in Makefile-minix.in
* Check for tgetent to find termcap, e.g., http://www.tex.ac.uk/tex-archive/macros/texinfo/texinfo/configure.ac
* Add support for rl_bind_key(), currently one needs to "hack" the Map[] * Add support for rl_bind_key(), currently one needs to "hack" the Map[]
* Add support for inhibiting completion: rl_inhibit_completion * Add support for inhibiting completion: rl_inhibit_completion

View File

@ -100,6 +100,9 @@
/* Enable static keyword, hides internal methods. */ /* Enable static keyword, hides internal methods. */
#undef HIDE #undef HIDE
/* Number of lines in history. */
#undef HIST_SIZE
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing /* Define to 1 if `lstat' dereferences a symlink specified with a trailing
slash. */ slash. */
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK #undef LSTAT_FOLLOWS_SLASHED_SYMLINK

46
configure vendored
View File

@ -872,6 +872,7 @@ enable_default_complete
enable_arrow_keys enable_arrow_keys
enable_sigstop enable_sigstop
enable_terminal_bell enable_terminal_bell
enable_history
' '
ac_precious_vars='build_alias ac_precious_vars='build_alias
host_alias host_alias
@ -1514,6 +1515,7 @@ Optional Features:
--enable-arrow-keys Enable ANSI arrow keys. --enable-arrow-keys Enable ANSI arrow keys.
--enable-sigstop Enable SIGSTOP key. --enable-sigstop Enable SIGSTOP key.
--enable-terminal-bell Enable terminal bell on completion. --enable-terminal-bell Enable terminal bell on completion.
--enable-history=LINES Enable scrollback history, default off.
Optional Packages: Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -4555,13 +4557,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
else else
lt_cv_nm_interface="BSD nm" lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:4558: $ac_compile\"" >&5) (eval echo "\"\$as_me:4560: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err) (eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5 cat conftest.err >&5
(eval echo "\"\$as_me:4561: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval echo "\"\$as_me:4563: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5 cat conftest.err >&5
(eval echo "\"\$as_me:4564: output\"" >&5) (eval echo "\"\$as_me:4566: output\"" >&5)
cat conftest.out >&5 cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin" lt_cv_nm_interface="MS dumpbin"
@ -5767,7 +5769,7 @@ ia64-*-hpux*)
;; ;;
*-*-irix6*) *-*-irix6*)
# Find out which ABI we are using. # Find out which ABI we are using.
echo '#line 5770 "configure"' > conftest.$ac_ext echo '#line 5772 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5 (eval $ac_compile) 2>&5
ac_status=$? ac_status=$?
@ -7297,11 +7299,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7300: $lt_compile\"" >&5) (eval echo "\"\$as_me:7302: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:7304: \$? = $ac_status" >&5 echo "$as_me:7306: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output. # So say no if there are warnings other than the usual output.
@ -7636,11 +7638,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7639: $lt_compile\"" >&5) (eval echo "\"\$as_me:7641: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:7643: \$? = $ac_status" >&5 echo "$as_me:7645: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output. # So say no if there are warnings other than the usual output.
@ -7741,11 +7743,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7744: $lt_compile\"" >&5) (eval echo "\"\$as_me:7746: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err) (eval "$lt_compile" 2>out/conftest.err)
ac_status=$? ac_status=$?
cat out/conftest.err >&5 cat out/conftest.err >&5
echo "$as_me:7748: \$? = $ac_status" >&5 echo "$as_me:7750: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext if (exit $ac_status) && test -s out/conftest2.$ac_objext
then then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
@ -7796,11 +7798,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7799: $lt_compile\"" >&5) (eval echo "\"\$as_me:7801: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err) (eval "$lt_compile" 2>out/conftest.err)
ac_status=$? ac_status=$?
cat out/conftest.err >&5 cat out/conftest.err >&5
echo "$as_me:7803: \$? = $ac_status" >&5 echo "$as_me:7805: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext if (exit $ac_status) && test -s out/conftest2.$ac_objext
then then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
@ -10180,7 +10182,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 10183 "configure" #line 10185 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -10276,7 +10278,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 10279 "configure" #line 10281 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -11105,6 +11107,22 @@ $as_echo "#define CONFIG_ANNOYING_NOISE /**/" >>confdefs.h
fi fi
# Default history size 1, i.e. disabled.
let HIST_SIZE=1
# Check whether --enable-history was given.
if test "${enable_history+set}" = set; then :
enableval=$enable_history; let HIST_SIZE=$enableval
fi
if test $HIST_SIZE -lt 1; then
let HIST_SIZE=1
fi
cat >>confdefs.h <<_ACEOF
#define HIST_SIZE $HIST_SIZE
_ACEOF
# Restore gnu89 inline semantics on gcc 4.3 and newer # Restore gnu89 inline semantics on gcc 4.3 and newer
saved_cflags="$CFLAGS" saved_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fgnu89-inline" CFLAGS="$CFLAGS -fgnu89-inline"

View File

@ -59,6 +59,16 @@ AC_ARG_ENABLE(terminal-bell,
[ --enable-terminal-bell Enable terminal bell on completion.], [ --enable-terminal-bell Enable terminal bell on completion.],
AC_DEFINE([CONFIG_ANNOYING_NOISE],, [Define to enable terminal bell on completion.])) AC_DEFINE([CONFIG_ANNOYING_NOISE],, [Define to enable terminal bell on completion.]))
# Default history size 1, i.e. disabled.
let HIST_SIZE=1
AC_ARG_ENABLE(history,
[ --enable-history=LINES Enable scrollback history, default off.],
let HIST_SIZE=$enableval)
if test $HIST_SIZE -lt 1; then
let HIST_SIZE=1
fi
AC_DEFINE_UNQUOTED(HIST_SIZE, $HIST_SIZE, [Number of lines in history.])
# Restore gnu89 inline semantics on gcc 4.3 and newer # Restore gnu89 inline semantics on gcc 4.3 and newer
saved_cflags="$CFLAGS" saved_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fgnu89-inline" CFLAGS="$CFLAGS -fgnu89-inline"

View File

@ -117,6 +117,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@ EXEEXT = @EXEEXT@
FGREP = @FGREP@ FGREP = @FGREP@
GREP = @GREP@ GREP = @GREP@
HIST_SIZE = @HIST_SIZE@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_PROGRAM = @INSTALL_PROGRAM@

View File

@ -108,6 +108,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@ EXEEXT = @EXEEXT@
FGREP = @FGREP@ FGREP = @FGREP@
GREP = @GREP@ GREP = @GREP@
HIST_SIZE = @HIST_SIZE@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_PROGRAM = @INSTALL_PROGRAM@

View File

@ -107,6 +107,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@ EXEEXT = @EXEEXT@
FGREP = @FGREP@ FGREP = @FGREP@
GREP = @GREP@ GREP = @GREP@
HIST_SIZE = @HIST_SIZE@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_PROGRAM = @INSTALL_PROGRAM@

View File

@ -138,6 +138,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@ EXEEXT = @EXEEXT@
FGREP = @FGREP@ FGREP = @FGREP@
GREP = @GREP@ GREP = @GREP@
HIST_SIZE = @HIST_SIZE@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_PROGRAM = @INSTALL_PROGRAM@

View File

@ -37,9 +37,9 @@
#define META(x) ((x) | 0x80) #define META(x) ((x) | 0x80)
#define ISMETA(x) ((x) & 0x80) #define ISMETA(x) ((x) & 0x80)
#define UNMETA(x) ((x) & 0x7F) #define UNMETA(x) ((x) & 0x7F)
#if !defined(HIST_SIZE) #ifndef HIST_SIZE /* Default to one line history, i.e. disabled. */
#define HIST_SIZE 20 #define HIST_SIZE 1
#endif /* !defined(HIST_SIZE) */ #endif
#define SEPS "\"#$&'()*:;<=>?[\\]^`{|}~\n\t " #define SEPS "\"#$&'()*:;<=>?[\\]^`{|}~\n\t "
/* /*
@ -237,7 +237,7 @@ static void tty_info(void)
tty_width = tty_rows = 0; tty_width = tty_rows = 0;
#ifdef USE_TERMCAP #ifdef USE_TERMCAP
bp = &buff[0]; bp = buff;
if ((term = getenv("TERM")) == NULL) if ((term = getenv("TERM")) == NULL)
term = "dumb"; term = "dumb";
if (tgetent(buff, term) < 0) { if (tgetent(buff, term) < 0) {