Commit Graph

45 Commits

Author SHA1 Message Date
Arthur Michas
93d952291f
Add rl_attempted_completion_over global to header
Signed-off-by: Arthur Michas <vikr@protonmail.com>
2024-09-07 02:53:08 +02:00
rcombs
f7b58d3c0d
Include stdio.h from editline.h
Fixes `#include <editline.h>` without first including `<stdio.h>`, which previously errored at the missing typedef for `FILE`.
2022-02-17 17:59:40 -06:00
abitmore
8f6d724e30 Add rl_set_getc_func()
So it's possible to install another implementation of rl_getc() function.
2019-05-07 17:58:06 -04:00
Joachim Nilsson
2137b9df9f Revert "Merge pull request #21 from cogutvalera/issue_1171"
This reverts commit cddd8d8de0, reversing
changes made to 4ec7d26a9d.
2018-11-15 10:27:22 +01:00
Joachim Nilsson
66d8ae84e2 Revert "Coding style and const fixes to last PR"
This reverts commit fbb1f8800a.
2018-11-15 10:26:03 +01:00
Joachim Nilsson
fbb1f8800a Coding style and const fixes to last PR
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-10-24 08:28:34 +02:00
Valera Cogut
4784fe2491 Hide secret information 2018-10-18 11:15:35 +03:00
Joachim Nilsson
9a16999f0e Remove GNU Readline rl_complete() prototype, for now
We should add a configure option --enable-readline-compat, or sth, so
rl_complete2() (removed in this commit) becomes the new rl_complete(),
and the current rl_complete() becomes el_complete().

The current implementation of rl_complete2() was is incomplete and also
not working properly.  To eliminate any confusion on the matter this
patch removes it.  To restore functionality we should, at the very
least, merge with complete() and possibly also refactor rl_find_token()
to share code with the legacy el_find_word().

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-13 19:06:05 +02:00
Joachim Nilsson
29b24dcf83 Clarify comment about future --enable-readline-compat interface
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-12 17:12:19 +02:00
Joachim Nilsson
77d531f5b5 Refactor completion handling and add FSF Readline callbacks
Still a bit raw, but the basic building blocks are there, waiting to be
cleaned up and released.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-11 19:55:43 +02:00
Joachim Nilsson
41bbb304b1 Export internal el_next_hist() and el_prev_hist()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-04-01 16:10:10 +02:00
Joachim Nilsson
bc7fc7e5c0 Fix #15: Alternate interface to plain readline(), for event loops
This rather big patch adds support for the GNU Readline alternate
interface, for use with event loops:

    void rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *lhandler);
    void rl_callback_read_char       (void);
    void rl_callback_handler_remove  (void);

The code has been tested using the testit and excallback examples.
Both regular editing and searching works as intended.

Also, the problem with lingering artefacts on screen when scrolling
through the history has been fixed.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-11 08:43:43 +01:00
Joachim Nilsson
779db8817e rl_refresh_line(): new (undocumented) readline compat fn
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-02 21:14:14 +01:00
Joachim Nilsson
29a71a53d0 rl_insert_text(): new readline compat fn
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-02 21:13:39 +01:00
Joachim Nilsson
a9d4247c09 Minor, header cleanup, whitespace fixes, comments
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-30 18:20:29 +01:00
Joachim Nilsson
2075dedc80 Remove leading (superfluous) comment
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-29 17:22:08 +01:00
Joachim Nilsson
54714631e2 Move All rights reserved to next line
All BSD style licenses put this text on a separate line, immediately
following the Copyright line.  The C-News license is confusing enough
to most people, so let's align at least a bit with the norm.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-29 17:20:21 +01:00
Joachim Nilsson
a70a933698 Modify header guards, __FILE_H__ is reserved for system headers
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-29 17:17:50 +01:00
Claus Fischer
317b43e488 rl_unintialize(): New function, free all memory after use
Free all allocated internal memory and reset variables so
rl_initialize() or readline() may be called again later.

Signed-off-by: Claus Fischer <claus.fischer@clausfischer.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-29 14:44:24 +01:00
Jakub Pawlo
91398ceb34 Prevent mangling of symbols when linking with C++
Signed-off-by: Jakub Pawlo <jakubpawlo@gmail.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-01-27 09:23:14 +01:00
Mattias Walström
7cd7fc4b61 Add support for el_no_hist to disable access to and auto-save of history.
This commit adds a new global variable 'el_no_hist' which can be used
to disable auto-save of history as well as access to history using prev
and next keybindings (up/down arrows).

Signed-off-by: Mattias Walström <lazzer@gmail.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-11-04 22:47:55 +01:00
Joachim Nilsson
bd9c8ddda6 Add some GNU readline compat functions for prompt handling and redisplay
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-09-17 05:49:06 +02:00
Joachim Nilsson
c7a6ff9317 Return el_status_t from el_bind_key() and el_bind_key_in_metamap()
The two functions el_bind_key() and el_bind_key_in_metamap() should
not print status message on stderr, but rather return the status of
the key binding operation.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-07-08 16:27:57 +02:00
Joachim Nilsson
897a98be55 Export el_del_char() 2013-07-08 16:21:54 +02:00
Joachim Nilsson
088dc1d1b2 Move handy macros to global header file, useful when binding keys. 2011-01-06 10:41:07 +01: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
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
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
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
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
be921400bb Merge el_no_echo patch from Festival speech-tools editline fork 2010-07-24 03:38:25 +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
536dcacb06 Rename and globalize internal data structures to make more similar to GNU Readline 2010-07-20 00:18:20 +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
6d8d857dd4 More build fixes, some code cleanup and untabify. 2008-12-02 21:58:55 +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
cab8f18472 Fix return type of rl_reset_terminal() 2008-06-09 00:30:45 +02:00
Joachim Nilsson
5ffe54c277 Minix editline v0.1.1
=====================

Lots of minor fixes and additions:

	* Bump version info in configure.ac
	* User editline.h added, installs to $prefix/include/editline.h
		- Based on Debian package version, but heavily updated.
	* Manpage installs to $prefix/share/man/man3/editline.3
		- Also slightly updated with contents from Debian package.
	* Revised README to mention existing Debian package, also cleaned
	  out the old README, which now lives in doc/README
	* Add TODO file.
	* Fix package description and make dist to bzip2 tarballs.
2008-06-08 00:32:45 +02:00