Home | History | Annotate | Download | only in libedit
History log of /src/lib/libedit/refresh.c
RevisionDateAuthorComments
 1.60  05-Dec-2024  christos Don't eat 0 width characters, print them.
 1.59  30-Jun-2024  christos Handle the case where the cursor is on the first character.
set -o vi
x ESC ~
(Robert Morris)
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279545
 1.58  09-Sep-2021  christos branches: 1.58.4;
Add casts to appease conversions between wchar_t and wint_t
 1.57  30-Mar-2020  ryo fix build error with SDEBUG, MAP_DEBUG, DEBUG_REFRESH
 1.56  04-Jan-2019  uwe Fix mis-applied change in previous. Don't increment r_oldcv twice.
PR lib/53803
 1.55  23-Oct-2018  christos Apply revisions 1.21, 1.22 from OpenBSD:

In re_fastputc(), set lastline to the new line, not the previous
line so it gets initialized properly. Fixes a crash in bc with
MALLOC_OPTIONS=UJ. OK deraadt@, committing on behalf of yasuoka@

Initialize "old" screen buffer lines before use; otherwise, they would
never get NUL-terminated and cause read buffer overruns.
This fixes for example segfaults in sftp(1) that could be triggered
by typing in an extremely long string (more than one line - the longer,
the likelier to crash), then hitting backspace once.
Problem reported and patch OK'ed by sthen@.

XXX: pullup-8
 1.54  30-Jun-2017  kre branches: 1.54.4; 1.54.6;

Allow wide characters (properly encoded as byte strings according to LC_CTYPE)
to be (perhaps part of) the "invisible" characters in a prompt, or the
required prompt character which follows the literal sequence (this character
must be one with a printing column width >= 1). The literal indicator
character (which is just a marker, and not printed anywhere) (the PSlit
parameter in sh(1)) can also be a wide char (passed to libedit as a wchar_t,
encoded as that by sh(1) or other applications that support this.)

Note: this has currently only been tested with everything ascii (C locale).
 1.53  27-Jun-2017  christos fix comment
 1.52  27-Jun-2017  christos - add literal sequence handling.
 1.51  09-May-2016  christos branches: 1.51.8;
s/protected/libedit_private/g
 1.50  02-May-2016  christos fix typos from Pedro Giffuni @FreeBSD
 1.49  11-Apr-2016  christos Get rid of private/public; keep protected (Ingo Schwarze)
 1.48  11-Apr-2016  christos Char -> wchar_t from Ingo Schwarze.
 1.47  11-Apr-2016  christos more macro WIDECHAR undoing from Ingo Schwarze.
 1.46  09-Apr-2016  christos More WIDECHAR elimination (Ingo Schwarze)
 1.45  02-Mar-2016  christos PR/50880: David Binderman: Remove redundant code.
While here, fix all debugging formats.
 1.44  17-Feb-2016  christos whitespace and header sorting changes (Ingo Schwarze). No functional changes.
 1.43  16-Feb-2016  christos More header cleanups from Ingo Schwarze.
 1.42  16-Feb-2016  christos From Ingo Scharze:
Let "el.h" include everything needed for struct editline,
and don't include that stuff multiple times. That also improves
consistency, also avoids circular inclusions, and also makes it
easier to follow what is going on, even though not quite as nice.
But it seems like the best we can do...
 1.41  16-Feb-2016  christos cleanup chartype.h includes (Ingo Schwarze)
 1.40  16-Feb-2016  christos cleanup inclusion of histedit.h (Ingo Schwarze)
 1.39  14-Feb-2016  christos From Ingo Schwarze:

As we have seen before, "histedit.h" can never get rid of including
the <wchar.h> header because using the data types defined there is
deeply ingrained in the public interfaces of libedit.

Now POSIX unconditionally requires that <wchar.h> defines the type
wint_t. Consequently, it can be used unconditionally, no matter
whether WIDECHAR is active or not. Consequently, the #define Int
is pointless.

Note that removing it is not gratuitious churn. Auditing for
integer signedness problems is already hard when only fundamental
types like "int" and "unsigned" are involved. It gets very hard
when types come into the picture that have platform-dependent
signedness, like "char" and "wint_t". Adding yet another layer
on top, changing both the signedness and the width in a platform-
dependent way, makes auditing yet harder, which IMHO is really
dangerous. Note that while removing the #define, i already found
one bug caused by this excessive complication - in the function
re_putc() in refresh.c. If WIDECHAR was defined, it printed an
Int = wint_t value with %c. Fortunately, that bug only affects
debugging, not production. The fix is contained in the patch.

With WIDECHAR, this doesn't change anything. For the case without
WIDECHAR, i checked that none of the places wants to store values
that might not fit in wint_t.

This only changes internal interfaces; public ones remain unchanged.
 1.38  11-Feb-2016  christos - Add some more Char casts
- reduce ifdefs by providing empty defs for nls functions (Ingo Schwarze)
 1.37  29-Jul-2011  christos pass -Wconversion
 1.36  28-Jul-2011  christos term -> terminal
XXX: need to rename key_ too.
 1.35  30-Dec-2009  christos Wide character support (UTF-8) from Johny Mattsson; currently disabled.
 1.34  28-Dec-2009  christos reduce diff with tcsh
 1.33  28-Dec-2009  christos Fix bug where tab completion on the second or > line that caused listing
ended up corrupting the display by an extra space in the beginning. Reported
by Mac Chan.
 1.32  17-Jul-2009  christos Simplify the code. No functional change.
 1.31  19-May-2009  christos always scroll when we advance past bottom. From Caleb Welton
cwelton at greenplum dot com
 1.30  31-Mar-2009  christos Implement literal prompt sequences. Now someone can implement
RL_PROMPT_START_LITERAL/RL_PROMPT_END_LITERAL :-)
 1.29  15-Feb-2009  christos pass lint on _LP64.
 1.28  10-Sep-2008  christos branches: 1.28.6;
Allow a single process to control multiple ttys (for pthreads using _REENTRANT)
using multiple EditLine objects. Mostly from Preston A. Elder.
 1.27  09-Nov-2005  christos branches: 1.27.20;
Refresh bug reported by Julien Torres:

going from:
activate -verbose
to:
reset -activation
results in:
reset -activationverbose"
instead of:
reset -activation

This is because we choose to insert "reset -" before the current line,
and the delete "e -" and insert "ion" in the appropriate place. The
cleareol code did not handle this case properly; we now cleareol to
the maximum number of characters of the first difference, the second
difference and the difference in line length.
 1.26  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.25  19-Jun-2003  christos From michael@moria.de:
- use __attribute__((__unused__)) in arguments where appropriate.
- some int -> size_t and char * to const char * conversions.
 1.24  10-Mar-2003  christos s/u_int32_t/unsigned int/
 1.23  15-Nov-2002  christos de-lint
 1.22  15-Nov-2002  christos PR/18995: David Laight: libedit fixes for posix conformant sh

The posix 'sh' specification defines vi-mode editing quite tightly.
The netbsd libedit code (used by sh to do this) was missing several
features, there were also minor errors in others.

Compare netbsd sh to the definition available from:
http://www.opengroup.org/onlinepubs/007904975/utilities/sh.html
In particular the following were not supported:
U - undo all changes to line
| - goto column
Y - yank to end of line
y - yank
# - comment out current line
@ - take input from shell alias [1]
G - goto numbered line in history buffer
v - edit history line with vi
_ - append word from last input line
. - redo last command
Other minor changes have also been made.

[1] This needs the shell to define an appropriate routine to
return the text of the alias. There is no requirement that
such a function exist.
 1.21  12-Nov-2002  thorpej Fix signed/unsigned comparison warnings.
 1.20  27-Oct-2002  christos vi mode and memory fixes from david laight.
 1.19  27-Oct-2002  christos PR/17954: SAITOH Masanobu: since we have opost and onlcr set, we don't need
to output \r to go to the end of line; \n is enough. From David Laight.
 1.18  18-Mar-2002  christos branches: 1.18.2;
- constify; passes all gcc and lint strict checks.
- add config.h [Jason Evans], to create a portable version of libedit that
can be easily compiled on other OS's.
 1.17  13-Apr-2001  lukem 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').
 1.16  10-Jan-2001  jdolecek Enlarge editline buffers as needed to support arbitrary length lines.
This also addresses lib/9712 by Phil Nelson.
 1.15  04-Sep-2000  lukem convert to new style guide, which includes:
- ansi prototypes & features (such as stdargs)
- 8 space indents
 1.14  13-Mar-2000  soren branches: 1.14.4;
Fix doubled 'the's.
 1.13  19-Feb-2000  mycroft Fix refresh glitches when using auto-margin.
 1.12  20-Jan-2000  christos Add support for automatic and magic margins (from tcsh)
This makes the rightmost column usable on all programs
that use editline.
 1.11  13-Nov-1999  lukem 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
 1.10  12-Nov-1999  lukem - 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.
 1.9  15-Oct-1999  jdolecek 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
 1.8  02-Jul-1999  simonb branches: 1.8.2;
More trailing white space.
 1.7  12-Jun-1999  christos Make this compile under linux
 1.6  05-Feb-1999  christos delint.
 1.5  12-Dec-1998  christos delint
 1.4  20-May-1998  christos cast is*() arg to unsigned char
 1.3  06-Jul-1997  christos Fix compiler warnings.
 1.2  11-Jan-1997  lukem RCSid police
editline first appeared in 4.4BSD not NetBSD1.0
 1.1  06-May-1994  cgd branches: 1.1.1;
Initial revision
 1.1.1.1  06-May-1994  cgd libedit!
 1.8.2.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.14.4.1  15-Mar-2003  he Pull up revision 1.19 (via patch, requested by msaitoh in ticket #14):
Since we have opost and onlcr set, we don't need to output \r;
\n is sufficient. Fixes PR#17954.
 1.18.2.1  05-Jan-2003  jmc Pull up revisions 1.18-1.19 (requested by masanobu in ticket #1048)
PR/17954: SAITOH Masanobu: since we have opost and onlcr set, we don't need
to output \r to go to the end of line; \n is enough. From David Laight.
 1.27.20.1  24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.28.6.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.51.8.1  23-Jul-2017  snj Pull up following revision(s) (requested by kre in ticket #102):
lib/libedit/Makefile: 1.64-1.65
lib/libedit/editline.3: 1.94-1.96
lib/libedit/editrc.5: 1.33
lib/libedit/el.c: 1.93-1.94
lib/libedit/el.h: 1.42
lib/libedit/literal.c: 1.1-1.3
lib/libedit/literal.h: 1.1-1.2
lib/libedit/prompt.c: 1.27
lib/libedit/read.c: 1.103
lib/libedit/refresh.c: 1.52-1.54
lib/libedit/refresh.h: 1.11
lib/libedit/terminal.c: 1.33
Make the default editrc file be $EDITRC (from env) if set, falling back
to $HOME/.editrc otherwise. Better support for this in sh coming.
--
Include EDITRC in doc.
--
mention the limitation of the literal sequence delimiter.
--
- handle literal escape sequence printing.
- factor out common code in allocation and freeing of the display.
--
- add literal sequence handling.
--
remove unused variable
--
add literal escape sequence support, patterned after the tcsh ones.
--
fix comment
--
Fix an obvious, but almost invisible typo (avoid some core dumps).
--
Allow wide characters (properly encoded as byte strings according to LC_CTYPE)
to be (perhaps part of) the "invisible" characters in a prompt, or the
required prompt character which follows the literal sequence (this character
must be one with a printing column width >= 1). The literal indicator
character (which is just a marker, and not printed anywhere) (the PSlit
parameter in sh(1)) can also be a wide char (passed to libedit as a wchar_t,
encoded as that by sh(1) or other applications that support this.)
Note: this has currently only been tested with everything ascii (C locale).
--
Remove workaround for ancient HTML generation code.
 1.54.6.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.54.6.1  10-Jun-2019  christos Sync with HEAD
 1.54.4.2  18-Jan-2019  pgoyette Synch with HEAD
 1.54.4.1  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.58.4.2  02-Aug-2025  perseant Sync with HEAD
 1.58.4.1  01-Jul-2024  perseant Sync with HEAD.

RSS XML Feed