Commit Graph

54 Commits

Author SHA1 Message Date
Joachim Nilsson
088dc1d1b2 Move handy macros to global header file, useful when binding keys. 2011-01-06 10:41:07 +01:00
Joachim Nilsson
4f134f1025 Reduce tgetent() buffer size from 2048 to 1024. 2010-08-12 16:27:10 +02:00
Joachim Nilsson
850e36f9db Fix SIGFPE regression in tty_info() introduced in rl_reset_terminal() commit.
When adding support for rl_reset_termial() the tty_info() code was also
refactored.  This however led to the introduction of a bug that caused
tty_cols to be set to zero.  This in turn caused c_possible() to fail
with SIGFPE in el_print_columns().

Regression was introduced in 1c89c9886c
2010-08-12 16:20:29 +02:00
Joachim Nilsson
d72069144e Minor cleanup of unnecessary explicit casts. 2010-08-11 21:19:41 +02:00
Joachim Nilsson
87e69be38b Add support for inhibiting completion: rl_inhibit_completion 2010-08-11 13:14:32 +02:00
Joachim Nilsson
1c89c9886c Refactor tty_info() to make rl_reset_terminal() useful. 2010-08-05 15:14:06 +02:00
Joachim Nilsson
de6ff117bb Implement compat. support for rl_instream and rl_outstream 2010-08-05 13:20:35 +02:00
Joachim Nilsson
5e9177fd18 Add support for el_bind_key() and example usage binding '?' in examples/cli.c
This changeset refactors el_bind_key_in_metamap() into two functions,
adding el_bind_key(), to provide the ability for the user to bind keys
in both the regular and the meta-key maps.

Several useful, but previously internal, functions have been made global to
facilitate the example code mentioned above. These are likely useful to the
user of this library as well:

  el_print_columns() - Display words in columns across a tty_cols wide screen.
  el_ring_bell()     - Can be used as default key binding function.
  el_find_word()     - Returns a copy of the word at rl_point.
2010-08-05 12:48:51 +02:00
Joachim Nilsson
27fcc878a1 Make sure rl_instream defaults to NULL and add rl_outstream. 2010-08-05 02:00:35 +02:00
Joachim Nilsson
5de90af58f Fix new GNU Readline compat function pointers. 2010-08-05 01:56:09 +02:00
Joachim Nilsson
0a75b182b1 Improve GNU readline compat, patch by Steve Tell in 1997 and 1998
This changeset adds support for:
   * rl_prep_terminal(),
   * rl_deprep_terminal(), both of which are only wrappers to rl_ttyset().
   * rl_getc()

and:
   * (*rl_getc_function), defaults to rl_getc()
   * (*rl_event_hook)
   * (*rl_prep_term_function), defaults to rl_prep_terminal()
   * (*rl_deprep_term_function), defaults to rl_deprep_terminal()

For further details, see http://www.cs.unc.edu/~tell/dist/magic-readline.README

Differences from Steve's commit include: signal safety in rl_getc(), restart
read() on EINTR, and make sure to support "int meta_flag" to rl_prep_terminal()
which is the GNU syntax.  To that end I reused the inverse of rl_meta_chars.
2010-08-05 01:08:30 +02:00
Joachim Nilsson
d04bdaf38f Add support for read_history(char *filename) and write_history(char *filename) 2010-08-04 02:23:05 +02:00
Joachim Nilsson
aea0d60478 Remove copyright, not big enough contribution - also, was not even in patch from Mr. Black. 2010-08-04 02:18:44 +02:00
Joachim Nilsson
04a0cbd902 Allocate history scrollback buffer at runtime instead of at configure.
Also make sure "unique history" is enabled by default in configure.
2010-08-04 02:12:19 +02:00
Joachim Nilsson
55aaddbc54 Restore add_history(), for compat and simplify code. 2010-08-03 21:01:01 +02:00
Joachim Nilsson
f1edf7ae52 Replace previous commit for quoted chars with a much improved one.
1. Simplify code in reposition()
2. Add tty_push() for commonly used operation, reduce code duplication.
3. Fix left() so that it treats 8-bit chars as one when not in meta-mode.
4. Replace isalnum() with homegrown implementation that understands 8-bit
   and control chars.
5. Fix ceol() before introducing ANSI "kill-to-end-of-line" escape code.

This actually seems to work, previously I erronesouly used an UTF-8
terminal for testing.  Which of course broke the test on an ISO-8859-1
[only] terminal.
2010-07-30 02:03:46 +02:00
Joachim Nilsson
f617f84293 Fix display of quoted (contro) characters w/o breaking 8-bit display 2010-07-26 02:09:15 +02:00
Joachim Nilsson
bde0c0c9d6 Cuddle else statments, that's the way of the samurai - also minor cleanup. 2010-07-26 02:03:31 +02:00
Joachim Nilsson
02acd55b2e Support for capitalizing words (M-c) from Festival speech-tools by Alan W Black <awb()cstr!ed!ac!uk> 2010-07-26 01:44:18 +02:00
Joachim Nilsson
167059d159 Obfuscate email address 2010-07-25 22:22:56 +02:00
Joachim Nilsson
20c55a58da Add el_bind_key_in_metamap() from Festival speech-tools.
Support for Meta key binding imported from Festival speech-tools, author
Alan W Black <awb()cstr!ed!ac!uk>.  Code released under the original license.
2010-07-25 22:17:10 +02:00
Joachim Nilsson
0d9ce0ce06 Refactor of variable names, for improved readline compat. 2010-07-25 22:14:14 +02:00
Joachim Nilsson
67e9aa3f2b Revert broken Debian patch for 8-bit char input, fix tty_show() instead.
This changeset fixes an old Debian patch that attempted to fix the display
of 8-bit characters in the function emacs().  It accidentally crippled the
function of M-d and M-DEL.  The latter was however also broken by being
mapped to wipe(), more on that below.

The real fix is to set rl_meta_chars to 0 by default and in the tty_show()
function, which tried to be smart and output control and meta characters
(in the wrong order as well).  Simply disabling the special code for output
of control characters fixes 8-bit input.

We also nuke the old and broken wipe() function that was mapped to M-DEL,
instead we map that key binding to bk_kill_word(), which works.
2010-07-25 22:01:04 +02:00
Joachim Nilsson
f16cbece5a Rename Signal --> el_intr_pending. From Festival speech-tools. 2010-07-24 03:46:58 +02:00
Joachim Nilsson
be921400bb Merge el_no_echo patch from Festival speech-tools editline fork 2010-07-24 03:38:25 +02:00
Joachim Nilsson
83e4837f39 Remove unused CHAR type and replace SIZE_T with size_t, we check for that. 2010-07-24 03:12:45 +02:00
Joachim Nilsson
a7eea67253 Cast size_t to int, confuses some compilers otherwise. 2010-07-24 03:09:00 +02:00
Joachim Nilsson
8e13c7b5ae Fix memory leak 2010-07-24 03:05:23 +02:00
Joachim Nilsson
02ea37e4de Clarify code when CONFIG_ANSI_ARROWS is selected. 2010-07-24 02:52:51 +02:00
Joachim Nilsson
5a8ad742d9 Adding -Wcast-qual revealed some more interesting casts. 2010-07-24 02:39:45 +02:00
Joachim Nilsson
522e534448 Remove unnecessary casts. 2010-07-24 02:21:28 +02:00
Joachim Nilsson
ceb1995733 Add fallback backspace in case tgetstr("le") fails. 2010-07-24 02:02:14 +02:00
Joachim Nilsson
98b846c8b1 Revert function pointers for rl_complete() and rl_list_possib() introduced in 0.2.2.
Instead merge afd8b4de9dca8ec6afc3 from http://github.com/heimdal/heimdal.git project.
This lets rl_complete() and rl_list_possib() become wrapper functions calling a set of
function pointers, set using rl_set_complete_func() and rl_set_list_possib_funct().

Each wrapper has a fallback to do filename completion, which in turn can be disabled
by leaving out --enable-default-complete from the configure line.

This change, admittedly quite intrusive for a library, is a better implementation in
many ways.  For one it is much more readable, but it also enables further adoption of
other editline forks as well as a simpler implementation of GNU Readline function
pointers rl_completion_entry_function and rl_attempted_completion_function at a later
stage.

My apologies to everyone for whom this change breaks backwards compatibility.  For
help on converting your code, please see examples/cli.c.
2010-07-24 00:50:40 +02:00
Joachim Nilsson
511a1a65a4 Nuke NEW, DISPOSE, RENEW, and COPYFROMTO macros, by Johan Danielsson
This is a manual merge of 98c988dd10888cfb72c4 from http://github.com/heimdal/heimdal
2010-07-23 11:01:51 +02:00
Joachim Nilsson
b51dad6408 Minor fixes from changeset a5f54865d41c3f181a06 from Heimdal project http://github.com/heimdal/heimdal 2010-07-23 09:46:49 +02:00
Joachim Nilsson
536dcacb06 Rename and globalize internal data structures to make more similar to GNU Readline 2010-07-20 00:18:20 +02:00
Joachim Nilsson
009d3f0568 Make UNIQUE_HISTORY configurable, remove TODO items and old Minix Makefile 2010-07-19 04:13:11 +02:00
Joachim Nilsson
6d2f4c99a3 Add configurable support for using termcap library for terminal size. 2010-07-18 18:57:07 +02:00
Joachim Nilsson
4c4a7e808c Make scrollback history (HIST_SIZE) configurable 2010-07-18 05:19:03 +02:00
Joachim Nilsson
885475fc49 Fix invalid function pointer declarations. 2010-07-18 02:41:38 +02:00
Joachim Nilsson
3c4cf96bfc More cleanup. Added license blurb to top of all source files.
Remove all old $Id:$ and similar constructs, they don't provide any
additional benefit anymore.

Add configure options for toggling terminal bell and  toying with
SIGSTOP using Ctrl-Z.  Rename config option for ANSI keys to get
a consistent namespace.

Also did some work on ANSI-fication of function definitions, lot's
of that was still lingering around.
2010-07-18 01:41:18 +02:00
Joachim Nilsson
34a314c8e7 ANSI-fication and lots of minor fixes inspired by Sparse warnings. 2010-07-17 22:38:05 +02:00
Joachim Nilsson
722dae35a2 Change mode 0644 on all source files. 2010-07-17 22:08:32 +02:00
Joachim Nilsson
87edc33897 Minor cleanup before release. 2010-03-09 21:18:03 +01:00
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
4898413730 Fix GCC warning 's might possibly be used uninitialized" 2009-02-08 20:19:58 +01:00
Joachim Nilsson
6d8d857dd4 More build fixes, some code cleanup and untabify. 2008-12-02 21:58:55 +01:00
Joachim Nilsson
77d483da02 Build fixes when building with GCC v4.3.2 and -W -Wall -Werror 2008-12-02 19:09:17 +01:00
Joachim Nilsson
62e900a061 Change rl_complete() and rl_list_possib() to be function pointers instead.
This is a much cleaner design and also works with or without the configure
--enable-default-complete option.

See the examples for details.
2008-10-02 09:09:09 +02:00
Joachim Nilsson
b935808b7d Minix editline v0.2.1
=====================

Fix Debian batch mode reader, read_redirected(), which is activated
when input comes from a file rather than a tty.  

The implementation of read_redirected() did not support lines longer
than 64 chars.  It tried to realloc(), but goofed up and instead
truncated all the first 64 chars.  The result was that each read
line only contained the reminder of a a division with 64... :-)
2008-06-09 22:55:13 +02:00