Commit Graph

218 Commits

Author SHA1 Message Date
mycroft 09aca455ce Remove an unused variable. 2001-11-08 19:34:41 +00:00
christos 18c98749bf If term_init() fails, cleanup and return NULL. This avoids other lossage.
Pointed by charles.
2001-11-02 04:47:47 +00:00
christos 41df15832a Finish initializing all the term data structures even if the terminal init
fails. This makes editline work on dumb terminals again. Noted by mycroft.
Oops, too agressive error checking.
2001-11-02 04:42:09 +00:00
christos 545f12e0c5 PR/14188: Anthony Mallet: Provide an opaque data pointer to client programs. 2001-10-09 13:50:29 +00:00
lukem ab71bef52a a couple of minor fixes. originally by Ruslan Ermilov <ru@FreeBSD.org>,
highlighted to me by way of Mike Barcroft <mike@FreeBSD.org> (thanks!)
2001-10-04 00:45:19 +00:00
jdolecek e7e71e37c6 history_def_enter: fix off-by-one mistake in delete condition (the behaviour
to keep at least one entry on the history list is retained)
This fixes lib/9704 by Phil Nelson.
2001-09-29 17:52:10 +00:00
christos eabba8b507 PR/14067: Anthony Mallet: Provide a programmatic way to set the read_char
function via a new el_set() operation.
Thanks, nicely done :-)
2001-09-27 19:29:50 +00:00
wiz 4c99916337 va_{start,end} audit:
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
If the va_list is used multiple times, do multiple va_starts/va_ends.
If a function gets va_list as argument, don't let it use va_end (since
it's the callers responsibility).

Improved by comments from enami and christos -- thanks!

Heimdal/krb4/KAME changes already fed back, rest to follow.

Inspired by, but not not based on, OpenBSD.
2001-09-24 13:22:25 +00:00
wiz 3f9984fc90 `existent', not `existant' 2001-06-19 13:42:07 +00:00
christos 93819542b3 PR/12963:Jason Waterman: Fix signed cast problems. 2001-05-17 01:02:17 +00:00
enami e58d00a406 Use relative path for symlink target so that it won't point outside of tree. 2001-05-16 07:09:26 +00:00
jdolecek 049f74e997 Back off previous and do differently:
Ensure that the <readline/history.h> link to <readline/readline.h> is
installed too for 'make includes'. Also, avoid creating obj dir.
This is finally real fix for lib/12929.
XXX Is this right?
2001-05-14 18:39:14 +00:00
jdolecek 6fc3f969bf Use <bsd.inc.mk>, instead of <bsd.prog.mk>, so that the readline.h header
is installed during the 'make includes'.
Fixes lib/12929 by Martin Husemann.
2001-05-14 07:41:30 +00:00
lukem 5e45b51a6b knf ch_enlargebufs(), to be *consistent* with the rest of this file... 2001-04-13 01:04:19 +00:00
lukem 4241f48b35 rename 3 arg ELRE_DEBUG to ELRE_ASSERT, add 2 arg ELRE_DEBUG, and change all
occurences of ELRE_DEBUG(foo,bar,) -> ELRE_DEBUG(foo,bar).  some compilers
(e.g, gcc on darwin) bitch about the former (`not enough args').
2001-04-13 00:53:11 +00:00
wiz caeeeac59d End sentence with a dot. 2001-04-02 18:29:49 +00:00
christos e125f8f194 chmod the history file to 600 so that only the owner can read it.
[inspired by the openbsd fix to readline]
2001-03-20 00:08:31 +00:00
jdolecek 86ebf640b0 sprinkle couple const 2001-01-23 15:55:30 +00:00
jdolecek d64e200968 term_rebuffer_display(): set el->el_term.t_size.v to terminals
height, not a magic value, so that e.g. el_display[] and el_vdisplay[]
are not bigger than needed.
Discussed with Christos Zoulas.
2001-01-10 22:42:56 +00:00
jdolecek 3b81461031 fix partial completion - we failed to refresh screen in that case 2001-01-10 08:10:45 +00:00
jdolecek 00ff7cacf5 Enlarge editline buffers as needed to support arbitrary length lines.
This also addresses lib/9712 by Phil Nelson.
2001-01-10 07:45:41 +00:00
jdolecek c8093bd336 term_beep(): use ordinary bell, don't attempt to use visual bell - if user wants
visual instead of ordinary bell, they should set their environment
appropriately
2001-01-09 19:43:15 +00:00
jdolecek 7be4ef2ff0 make array of functions and help array const 2001-01-09 19:22:31 +00:00
jdolecek 417c215317 make constant arrays a const 2001-01-09 17:31:04 +00:00
jdolecek a76c617ce5 make constant arrays a const 2001-01-09 17:22:09 +00:00
jdolecek fa6e217baf el_line_t: make 'limit' const 2001-01-06 14:44:50 +00:00
christos 304ebe4875 depoison the pure editline code from readline compatibility hacks. 2001-01-05 22:45:30 +00:00
jdolecek 74c6c9c204 Standard location of readline headers is /usr/include/readline/, so install
them there.
readline.h of libedit had to move to subdirectory 'readline', due to the way
BSD makefiles work; this is better than potentially fragile Makefile hacks
2001-01-05 21:15:49 +00:00
christos 2f3389ce5e consistently check for allocation failures and return -1, if we could not
get more memory.
2001-01-04 15:56:31 +00:00
christos ab7e5eaeb3 fix lint problems. 2001-01-04 15:55:53 +00:00
christos ed19c5fdb0 fix dumb typo in signal setup [from OpenBSD]
return -1 if alloc fails.
2001-01-04 15:55:03 +00:00
jdolecek a8b4a741c5 bump libedit minor - addition of rl_special_prefixes and rl_completion_append_character 2001-01-01 15:54:07 +00:00
jdolecek a85f9ca211 Add support for rl_completion_append_character and rl_special_prefixes.
This addresses lib/10513 by Giles Lean. Tested with PostgreSQL 7.0.2 psql.
2001-01-01 15:52:25 +00:00
jdolecek 939ac12578 history_tokenize(): fix one off-by-one bug
rl_complete_internal(): only replace the completed string with common part
	of possible matches if there is a possible completion
2001-01-01 11:03:16 +00:00
jdolecek 26ffe99b32 rl_display_match_list():
* pad entries shorter than 'max' by spaces correctly
	* fix off-by-one error which caused extra newline to be printed
	  if the list fit exactly to a screen
	* fix typo in _rl_qsort_string_compare, which caused the list to not
	  be sorted after all
2000-12-31 09:50:32 +00:00
jdolecek c860130fa0 term_beep(): if terminal supports both visual and ordinary bell, 'ring' both 2000-12-30 22:46:05 +00:00
jdolecek 2c10cd6472 bump libedit minor - added some public stuff for readline emulation 2000-12-23 22:07:16 +00:00
jdolecek 4acffb6417 completion_matches(): fix a off-by-one bug, fix variable name typo
implement displaying of possible completions, add hook to display the list
	on second rl_complete() invocation in row (typically, double <TAB>)

This addresses the completion part of lib/11581 by Richard Earnshaw.
2000-12-23 22:02:20 +00:00
jmc 50b6095c16 Alloc the keys structure with A_K_NKEYS as the multiplier rather than a
hardcoded value of 4.

A_K_NKEYS is currently 6 and this mismatch was stomping memory when
initializing the keys. (specifically gdb lost the exec file name if it was
a long path name).
2000-11-28 22:37:51 +00:00
christos ff59a2fadd - add support for home and end keys.
- improve debugging support
2000-11-11 22:18:57 +00:00
lukem cff6006e56 improve description of line syntax 2000-11-08 00:09:38 +00:00
sommerfeld acf589519a format string audit (silence warnings, save space) 2000-10-04 16:21:39 +00:00
lukem 6592086aee - generate ansi prototypes instead of using __P(). noted by christos
- fix a couple of comments
2000-09-04 23:45:18 +00:00
lukem e4b166ade0 convert to new style guide 2000-09-04 23:36:41 +00:00
lukem d30d584a91 convert to new style guide, which includes:
- ansi prototypes & features (such as stdargs)
- 8 space indents
2000-09-04 22:06:28 +00:00
lukem f5e2e0bfea history_def_set has a `const int' as a third arg, not an `int'.
picked up by the ultrix compiler, reported by simonb@ ...
2000-08-29 07:04:32 +00:00
mrg 7f59d8e891 use .tmp temporaries for generated files, to avoid having failed generated
output being used.
2000-08-15 12:01:40 +00:00
chuck c23199d5e1 make xxgdb and a gdb linked with libedit's readline emulation work
properly together.   xxgdb communicates with a gdb running on a pty
that it sets to -echo,-onlcr prior to forking the gdb process.
GNU readline preserves the -echo setting while libedit was undoing it
(setting the tty to a sane state and totally confusing xxgdb's parser).

this diff simply disables libedit if both readline emulation and
"stty -echo" are used/set.   that is enough to make xxgdb work once
again, but (XXX) this is not how GNU readline handles stty -echo (it
does not echo anything, but editing commands like ^A,^K, etc.
still work), so the readline emulation isn't perfect.

change reviewed by christos.
2000-08-02 03:36:39 +00:00
sommerfeld 01d7e8693f Only look in home directory for .editrc. (Discussed with Christos.) 2000-06-28 20:37:44 +00:00
lukem 78dc0c22fa * add -m option to makelist, which generates an mdoc table with the key
bindings and their descriptions
* manually add the output of 'sh ./makelist -m vi.c ed.c common.c' to
  a new section in editrc(5) called `EDITOR COMMANDS'
2000-06-21 03:21:28 +00:00
lukem fd194fea27 use strtol() (instead of atoi()) for sane error detection 2000-06-02 13:37:12 +00:00
christos cd8eacbb27 don't dump core on empty files. 2000-05-15 12:15:38 +00:00
soren 89c5a767f8 Fix doubled 'the's. 2000-03-13 22:55:05 +00:00
jdolecek 371967cec8 Fix _rl_compat_sub() to really honour 'globally' flag instead
of making the substitution always globally - affects
	_history_expand_command() and in turn history_expand()

All praise lint :)
2000-03-10 13:06:43 +00:00
jdolecek 833166a288 readline(): don't dereference NULL pointer if prompt is NULL
history_tokenize(): avoid stepping too far if backslash is last character
	on the passed string
update some comments

This makes gdb \ escaping work reliably and fixes lib/9511 by Assar Westerlund.
2000-03-10 12:55:15 +00:00
jdolecek 1f0ecc5ce4 include <stdlib.h> to get definition of malloc() and free(), so it's
possible to compile this file separately when debugging
2000-03-10 12:25:47 +00:00
chopps fe7be4eb7b el_insertstr takes a "const char *" not "char *" now as it doesn't modify
the argument.
2000-02-28 17:41:04 +00:00
mycroft 05fc321ebf Fix refresh glitches when using auto-margin. 2000-02-19 09:08:16 +00:00
christos 0dded5f65c Add support for automatic and magic margins (from tcsh)
This makes the rightmost column usable on all programs
that use editline.
2000-01-20 22:56:21 +00:00
christos 6c14e6198e PR/9244: Kevin Schoedel: libedit dumps bindings inconsistently 2000-01-19 18:31:10 +00:00
christos b2309a74ae PR/9243: Kevin Schoedel: libedit ignores repeat count 2000-01-19 18:30:19 +00:00
lukem 850279f2b9 missing , 1999-11-26 18:38:27 +00:00
lukem 1f11bc4cc8 instead of using a private coord_t global variable to store the size of the
rprompt, use the previously unused coord_t el->el_rprompt.p_pos
1999-11-13 11:32:12 +00:00
lukem 509864fa8f - implement printing a right-side prompt. code derived from similar work
I wrote for tcsh(1) three years ago.
- implement EL_RPROMPT, which allows a setting/getting of a function which
  returns a string to be used as the right-side prompt.
- improve HISTORY and AUTHORS sections in editline(3).
- bump shlib minor version for EL_RPROMPT.

XXX: due to an implementation issue, the rprompt has a 1 space gap before the
     edge of the logical screen. editline's logical screen is 1 space less
     than the full screen width, so there's a 2 space gap between the rprompt
     and the right end of the physical screen. i'm not concerned about this.
1999-11-12 01:05:07 +00:00
lukem e7d4e16bdf Fix pointer arithmatic (caused problems on LP64, including ftp dumping
core when `edit' was turned off then on).
Problem solved by David Huggins-Daines <dhd@eradicator.org>
1999-10-24 04:04:13 +00:00
jdolecek 7c714abab4 don't assume locales are not working - it may not be the case
re_refresh(): cast the character passed to re_addc() to unsigned char,
        so we don't end up calling isprint() with negative value
        when chars are signed and character value is >= 128
1999-10-15 17:01:19 +00:00
lukem 332ab876a2 update post change to return value of tputs() third argument 1999-10-04 23:24:04 +00:00
lukem 65c98beb1a remove some lint 1999-10-04 23:23:21 +00:00
lukem 9962715a2e apparantly need <unistd.h> for portable way of getting _POSIX_VDISABLE 1999-09-26 14:37:47 +00:00
lukem 8494e0e800 * in el_source():
- don't reopen fp if it was successfully opened in a previous check
	- use strlcpy()/strlcat() instead of snprintf() to build a pathname,
	  since the former are more portable to other systems than the latter
* whitespace fascism
1999-09-21 00:55:55 +00:00
lukem 250f2917a0 fix id header... 1999-09-21 00:07:03 +00:00
lukem 1dbb61e63e more whitespace fascism 1999-09-20 23:43:42 +00:00
sommerfeld 15b8b5a50b minor tweak to previous fix: don't spuriously truncate final newline
under emacs.
1999-08-08 01:25:05 +00:00
sommerfeld 3e32553f0b Fix PR7685 (gdb under emacs prints spurious ^M and messes up terminal)
plus a few bogons noted along the way:
	1) Set EDIT_DISABLED if terminal type is emacs.
	2) fix bug in NO_TTY mode which caused it to not notice CR or LF
	3) implement EDIT_DISABLED within libedit to be somewhat like NO_TTY,
		except that a prompt is printed first.
1999-08-02 01:01:55 +00:00
christos 9453db6b2d Use LIBEDITDIR instead of CURDIR so we can use that Makefile to compile
libedit from another directory.
1999-07-06 14:10:21 +00:00
lukem 87c1844d34 don't try to free() something allocated with alloca() in rl_complete_internal().
(noticed while using completion in gdb and getting inundated with warnings from
the new free())
1999-07-03 11:55:51 +00:00
simonb 1528b77539 More trailing white space. 1999-07-02 15:14:07 +00:00
christos c3f0ff041d Make this compile under linux 1999-06-12 18:58:05 +00:00
garbled 38c96853cf Last of the .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages.  Wheee!
1999-03-22 19:44:33 +00:00
mycroft b59b039954 Add missing , in he_errlist[] initializer. Yay lint. 1999-03-06 00:17:25 +00:00
itohy 0abd947255 Add minimal dependency to make "make depend" optional
after cleandir.
1999-03-04 11:45:22 +00:00
abs edc1a24a56 Add a note to update src/distrib/sets/lists/base/shl.*, and add a missing
RCS Id.
1999-02-25 08:02:19 +00:00
christos 468bdc50fc PR/6957: Wolfgang Helbig: libedit swaps CR and LF control chars. 1999-02-07 14:34:05 +00:00
christos 571b899770 delint. 1999-02-05 20:53:49 +00:00
christos 84ee55f13e Encode the history lines using strvis() before saving it. Fixes gdb history
problem with missing newlines.
1999-02-05 20:52:23 +00:00
christos 0d4dea9233 M-X:<enter> core-dumped. 1999-02-05 20:38:01 +00:00
kleink 3ed4fcf61e In userland, pull in <errno.h> instead of <sys/errno.h> for the declaration
of errno.
1999-01-11 22:39:59 +00:00
lukem ddfeeeebfd fix history() prototype. (d@openbsd.org) 1999-01-05 22:46:22 +00:00
kleink 37709da758 Change multiple inclusion protection symbol name to NetBSD convention which
doesn't violate namespace rules.
1998-12-20 17:52:01 +00:00
christos a6d4afba22 delint 1998-12-12 20:08:21 +00:00
christos a0be074d8b many problems; variables hidden by others, size_t <-> confusion 1998-12-12 19:54:16 +00:00
christos 61df62e6a8 - missing error message from array could cause core dump
- delint
1998-12-12 19:52:51 +00:00
cgd 244d803bb3 per e-mail with christos: history_next_event() should return -1, not NULL,
in case of error, just like history_prev_event() does.
1998-12-03 17:51:16 +00:00
christos 5e435627f6 fix core-dump caused by maps not being initialized before tty is called. 1998-09-28 11:00:05 +00:00
christos 622528ad62 Obey incoming tty char settings. 1998-09-27 18:04:12 +00:00
christos 016aaad0ba PR/6081: Wolfgang Helbig: search broken in vi mode. When patbuf was changed
to be dynamically allocated, sizeof was not changed appropriately.
1998-09-02 21:33:50 +00:00
lukem f87d250404 * add more checks for NULL pointers in passed arguments
* implement el_get(EditLine *, int op, void *result), which does the
  inverse of el_set()
* add EL_EDITMODE operation to el_set and el_get; if non zero editing
  is enabled (the default).
* add "edit  on | off" editrc command, which modifies EL_EDITMODE.
  users can now add '*:edit off' in ~/.editrc as an advisory to
  disable editing.

NOTE: at this time EL_EDITMODE is just an indication of the
state of the 'edit' command. It's up to the application to check
this after el_source() or el_parse() to determine if editing is still
required.
1998-07-29 02:26:00 +00:00
lukem a7d411eb83 documentation is always probably incomplete; don't make an issue of it 1998-06-08 10:56:43 +00:00
lukem fe1a16ac05 * implement CC_REFRESH_BEEP; as per CC_REFRESH but beep as well. this
is useful in completion when a partial completion is found
* remove entry in BUGS about el_parse(); that was fixed a while ago
1998-06-01 14:31:26 +00:00
christos 9f2cd5c8ff Show the simpler way. 1998-05-20 01:38:53 +00:00