binutils-gdb/readline/examples/rlfe
Jan Kratochvil cc88a640ca Imported readline 6.2, and upstream patch 001.
[patch 0/3] readline-6.2 rebase
http://sourceware.org/ml/gdb-patches/2011-05/msg00003.html
[patch 1/3] readline-6.2: Merge of already posted patches
http://sourceware.org/ml/gdb-patches/2011-05/msg00004.html
	=
	[Bug-readline] [RFC/readline] bind.c, rl_function_dumper, Free allocated
	http://lists.gnu.org/archive/html/bug-readline/2011-03/msg00000.html
	[Bug-readline] [patch] Fix underquotation in readline/examples/rlfe/conf
	http://lists.gnu.org/archive/html/bug-readline/2011-04/msg00001.html
	[Bug-readline] [patch] Makefile.in htm<->html
	http://lists.gnu.org/archive/html/bug-readline/2011-04/msg00002.html
	Re: [Bug-readline] [patch] Makefile.in dependency: callback.o: xmalloc.h
	http://lists.gnu.org/archive/html/bug-readline/2011-04/msg00004.html
	[Bug-readline] [patch] Remove . from the VPATH directive
	http://lists.gnu.org/archive/html/bug-readline/2011-04/msg00005.html
	Eli Zaretskii's __MSDOS__ / __GO32__ / __MINGW32__ / __DJGPP__ stuff:
	http://sourceware.org/ml/gdb/2011-04/msg00002.html
	Jan Kratochvil's patch for FSF GDB tree local-specific changes:
	http://sourceware.org/ml/gdb/2011-04/msg00006.html
	Preservation of existing ChangeLog.gdb files, their updates.
[patch 2/3] readline-6.2: Workaround "ask" regression
http://sourceware.org/ml/gdb-patches/2011-05/msg00005.html
[patch 3/3] readline-6.2: Revert 5.x compat., apply 6.x compat.
http://sourceware.org/ml/gdb-patches/2011-05/msg00006.html
[patch 4/3] readline-6.2: Substitute inc-hist.texinfo
http://sourceware.org/ml/gdb-patches/2011-05/msg00010.html

readline/
	Workaround gdb.base/completion.exp regression on readline-6.2.
	* complete.c (get_y_or_n): Disable the return on RL_STATE_CALLBACK.

	Imported readline 6.2, and upstream patch 001.
	* configure: Regenerate.

readline/doc/
	* hsuser.texi (Using History Interactively): Disable !BashFeatures
	@defcodeindex.  Make the `Programming with GNU History' reference
	external.
	* inc-hist.texinfo: Remove.

	Imported readline 6.2, and upstream patch 001.

readline/examples/
	Imported readline 6.2, and upstream patch 001.

readline/examples/rlfe/
	Imported readline 6.2, and upstream patch 001.

gdb/
	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac <--with-system-readline> (for readline_echoing_p):
	Remove the test.
	* tui/tui-io.c (tui_old_readline_echoing_p): Rename to ...
	(tui_old_rl_echoing_p): ... here.
	(tui_setup_io): Rename extern declaration readline_echoing_p to
	_rl_echoing_p.  Adjust assignments for the both renames.

gdb/doc/
	* Makefile.in (GDB_DOC_SOURCE_INCLUDES): Rename inc-hist.texinfo to
	hsuser.texi.
	* gdb.texinfo <!SYSTEM_READLINE>: Rename inc-hist.texinfo inclusion and
	comment to hsuser.texi.  Change rluser.texi name in the comment.
2011-05-11 23:38:44 +00:00
..
ChangeLog Imported readline 6.2, and upstream patch 001. 2011-05-11 23:38:44 +00:00
ChangeLog.gdb Imported readline 6.2, and upstream patch 001. 2011-05-11 23:38:44 +00:00
config.h.in Imported readline 6.2, and upstream patch 001. 2011-05-11 23:38:44 +00:00
configure Imported readline 6.2, and upstream patch 001. 2011-05-11 23:38:44 +00:00
configure.in Imported readline 6.2, and upstream patch 001. 2011-05-11 23:38:44 +00:00
extern.h Imported readline 6.2, and upstream patch 001. 2011-05-11 23:38:44 +00:00
Makefile.in Imported readline 6.2, and upstream patch 001. 2011-05-11 23:38:44 +00:00
os.h Imported readline 6.2, and upstream patch 001. 2011-05-11 23:38:44 +00:00
pty.c Imported readline 6.2, and upstream patch 001. 2011-05-11 23:38:44 +00:00
README
rlfe.c Imported readline 6.2, and upstream patch 001. 2011-05-11 23:38:44 +00:00
screen.h

rlfe (ReadLine Front-End) is a "universal wrapper" around readline.
You specify an interactive program to run (typically a shell), and
readline is used to edit input lines.

There are other such front-ends; what distinguishes this one is that
it monitors the state of the inferior pty, and if the inferior program
switches its terminal to raw mode, then rlfe passes your characters
through directly.  This basically means you can run your entire
session (including bash and terminal-mode emacs) under rlfe.

FEATURES

* Can use all readline commands (and history) in commands that
read input lines in "canonical mode" - even 'cat'!

* Automatically switches between "readline-editing mode" and "raw mode"
depending on the terminal mode.  If the inferior program invokes
readline itself, it will do its own line editing.  (The inferior
readline will not know about rlfe, and it will have its own history.)
You can even run programs like 'emavs -nw' and 'vi' under rlfe.
The goal is you could leave rlfe always on without even knowing
about it.  (We're not quite there, but it works tolerably well.)

* The input line (after any prompt) is changed to bold-face.

INSTALL

The usual: ./configure && make && make install

Note so far rlfe has only been tested on GNU Linux (Fedora Core 2)
and Mac OS X (10.3).

This assumes readline header files and libraries are in the default
places.  If not, you can create a link named readline pointing to the
readline sources.  To link with libreadline.a and libhistory.a
you can copy or link them, or add LDFLAGS='-/path/to/readline' to
the make command-line.

USAGE

Just run it.  That by default runs bash.  You can run some other
command by giving it as command-line arguments.

There are a few tweaks:  -h allows you to name the history file,
and -s allows you to specify its size.  It default to "emacs" mode,
but if the the environment variable EDITOR is set to "vi" that
mode is chosen.

ISSUES

* The mode switching depends on the terminal mode set by the inferior
program.  Thus ssh/telnet/screen-type programs will typically be in
raw mode, so rlfe won't be much use, even if remote programs run in
canonical mode.  The work-around is to run rlfe on the remote end.

* Echo supression and prompt recognition are somewhat fragile.
(A protocol so that the o/s tty code can reliably communicate its
state to rlfe could solve this problem, and the previous one.)

* See the intro to rlfe.c for more notes.

* Assumes a VT100-compatible terminal, though that could be generalized
if anybody cares.

* Requires ncurses.

* It would be useful to integrate rlfe's logic in a terminal emulator.
That would make it easier to reposition the edit position with a mouse,
integrate cut-and-paste with the system clipboard, and more robustly
handle escape sequence and multi-byte characters more robustly.

AUTHOR

Per Bothner <per@bothner.com>

LICENSE

GPL.