summaryrefslogtreecommitdiffstats
path: root/contrib/libreadline
diff options
context:
space:
mode:
authorsbruno <sbruno@FreeBSD.org>2013-11-03 20:38:51 +0000
committersbruno <sbruno@FreeBSD.org>2013-11-03 20:38:51 +0000
commit2bb87257fa61414e1cf441ab211bba440e9e53f9 (patch)
treecfd37807887223564c5857ac6bde9357014ba120 /contrib/libreadline
parent2041181afbfef75d20a432523e8c92bc125acdd5 (diff)
downloadFreeBSD-src-2bb87257fa61414e1cf441ab211bba440e9e53f9.zip
FreeBSD-src-2bb87257fa61414e1cf441ab211bba440e9e53f9.tar.gz
Update libreadline with vendor patches 8-13 as fetched from:
ftp://ftp.cwru.edu/pub/bash/readline-5.2-patches/ MFC after: 2 weeks
Diffstat (limited to 'contrib/libreadline')
-rw-r--r--contrib/libreadline/display.c57
-rw-r--r--contrib/libreadline/input.c2
-rwxr-xr-xcontrib/libreadline/support/shobj-conf20
3 files changed, 51 insertions, 28 deletions
diff --git a/contrib/libreadline/display.c b/contrib/libreadline/display.c
index 728364f..bab04d7 100644
--- a/contrib/libreadline/display.c
+++ b/contrib/libreadline/display.c
@@ -392,14 +392,14 @@ rl_expand_prompt (prompt)
t = ++p;
local_prompt = expand_prompt (p, &prompt_visible_length,
&prompt_last_invisible,
- (int *)NULL,
+ &prompt_invis_chars_first_line,
&prompt_physical_chars);
c = *t; *t = '\0';
/* The portion of the prompt string up to and including the
final newline is now null-terminated. */
local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length,
(int *)NULL,
- &prompt_invis_chars_first_line,
+ (int *)NULL,
(int *)NULL);
*t = c;
local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
@@ -911,6 +911,10 @@ rl_redisplay ()
second and subsequent lines start at inv_lbreaks[N], offset by
OFFSET (which has already been calculated above). */
+#define INVIS_FIRST() (prompt_physical_chars > _rl_screenwidth ? prompt_invis_chars_first_line : wrap_offset)
+#define WRAP_OFFSET(line, offset) ((line == 0) \
+ ? (offset ? INVIS_FIRST() : 0) \
+ : ((line == prompt_last_screen_line) ? wrap_offset-prompt_invis_chars_first_line : 0))
#define W_OFFSET(line, offset) ((line) == 0 ? offset : 0)
#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
#define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l])
@@ -945,7 +949,13 @@ rl_redisplay ()
_rl_last_c_pos != o_cpos &&
_rl_last_c_pos > wrap_offset &&
o_cpos < prompt_last_invisible)
- _rl_last_c_pos -= wrap_offset;
+ _rl_last_c_pos -= prompt_invis_chars_first_line; /* XXX - was wrap_offset */
+ else if (linenum == prompt_last_screen_line && prompt_physical_chars > _rl_screenwidth &&
+ (MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
+ cpos_adjusted == 0 &&
+ _rl_last_c_pos != o_cpos &&
+ _rl_last_c_pos > (prompt_last_invisible - _rl_screenwidth - prompt_invis_chars_first_line))
+ _rl_last_c_pos -= (wrap_offset-prompt_invis_chars_first_line);
/* If this is the line with the prompt, we might need to
compensate for invisible characters in the new line. Do
@@ -1049,7 +1059,7 @@ rl_redisplay ()
tx = _rl_col_width (&visible_line[pos], 0, nleft) - visible_wrap_offset;
else
tx = nleft;
- if (_rl_last_c_pos > tx)
+ if (tx >= 0 && _rl_last_c_pos > tx)
{
_rl_backspace (_rl_last_c_pos - tx); /* XXX */
_rl_last_c_pos = tx;
@@ -1205,7 +1215,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
int current_line, omax, nmax, inv_botlin;
{
register char *ofd, *ols, *oe, *nfd, *nls, *ne;
- int temp, lendiff, wsatend, od, nd;
+ int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
int current_invis_chars;
int col_lendiff, col_temp;
#if defined (HANDLE_MULTIBYTE)
@@ -1221,7 +1231,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
temp = _rl_last_c_pos;
else
- temp = _rl_last_c_pos - W_OFFSET(_rl_last_v_pos, visible_wrap_offset);
+ temp = _rl_last_c_pos - WRAP_OFFSET (_rl_last_v_pos, visible_wrap_offset);
if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode
&& _rl_last_v_pos == current_line - 1)
{
@@ -1466,6 +1476,8 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
_rl_last_c_pos = lendiff;
}
+ o_cpos = _rl_last_c_pos;
+
/* When this function returns, _rl_last_c_pos is correct, and an absolute
cursor postion in multibyte mode, but a buffer index when not in a
multibyte locale. */
@@ -1475,7 +1487,9 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
/* We need to indicate that the cursor position is correct in the presence of
invisible characters in the prompt string. Let's see if setting this when
we make sure we're at the end of the drawn prompt string works. */
- if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 && _rl_last_c_pos == prompt_physical_chars)
+ if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 &&
+ (_rl_last_c_pos > 0 || o_cpos > 0) &&
+ _rl_last_c_pos == prompt_physical_chars)
cpos_adjusted = 1;
#endif
#endif
@@ -1566,11 +1580,16 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
}
else
{
- /* We have horizontal scrolling and we are not inserting at
- the end. We have invisible characters in this line. This
- is a dumb update. */
_rl_output_some_chars (nfd, temp);
_rl_last_c_pos += col_temp;
+ /* If nfd begins before any invisible characters in the prompt,
+ adjust _rl_last_c_pos to account for wrap_offset and set
+ cpos_adjusted to let the caller know. */
+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
+ {
+ _rl_last_c_pos -= wrap_offset;
+ cpos_adjusted = 1;
+ }
return;
}
/* Copy (new) chars to screen from first diff to last match. */
@@ -1578,15 +1597,15 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
if ((temp - lendiff) > 0)
{
_rl_output_some_chars (nfd + lendiff, temp - lendiff);
-#if 1
/* XXX -- this bears closer inspection. Fixes a redisplay bug
reported against bash-3.0-alpha by Andreas Schwab involving
multibyte characters and prompt strings with invisible
characters, but was previously disabled. */
- _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
-#else
- _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff);
-#endif
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ twidth = _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
+ else
+ twidth = temp - lendiff;
+ _rl_last_c_pos += twidth;
}
}
else
@@ -1780,7 +1799,7 @@ _rl_move_cursor_relative (new, data)
int woff; /* number of invisible chars on current line */
int cpos, dpos; /* current and desired cursor positions */
- woff = W_OFFSET (_rl_last_v_pos, wrap_offset);
+ woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
cpos = _rl_last_c_pos;
#if defined (HANDLE_MULTIBYTE)
/* If we have multibyte characters, NEW is indexed by the buffer point in
@@ -1794,7 +1813,11 @@ _rl_move_cursor_relative (new, data)
/* Use NEW when comparing against the last invisible character in the
prompt string, since they're both buffer indices and DPOS is a
desired display position. */
- if (new > prompt_last_invisible) /* XXX - don't use woff here */
+ if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
+ (prompt_physical_chars > _rl_screenwidth &&
+ _rl_last_v_pos == prompt_last_screen_line &&
+ wrap_offset != woff &&
+ new > (prompt_last_invisible-_rl_screenwidth-wrap_offset)))
{
dpos -= woff;
/* Since this will be assigned to _rl_last_c_pos at the end (more
diff --git a/contrib/libreadline/input.c b/contrib/libreadline/input.c
index 85b56c9..a84038b 100644
--- a/contrib/libreadline/input.c
+++ b/contrib/libreadline/input.c
@@ -154,7 +154,7 @@ _rl_unget_char (key)
{
pop_index--;
if (pop_index < 0)
- pop_index = ibuffer_len - 1;
+ pop_index = ibuffer_len;
ibuffer[pop_index] = key;
return (1);
}
diff --git a/contrib/libreadline/support/shobj-conf b/contrib/libreadline/support/shobj-conf
index ef7863a..358b278 100755
--- a/contrib/libreadline/support/shobj-conf
+++ b/contrib/libreadline/support/shobj-conf
@@ -10,7 +10,7 @@
# Chet Ramey
# chet@po.cwru.edu
-# Copyright (C) 1996-2002 Free Software Foundation, Inc.
+# Copyright (C) 1996-2007 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -114,7 +114,7 @@ linux*-*|gnu*-*|k*bsd*-gnu-*)
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
;;
-freebsd2* | netbsd*)
+freebsd2*)
SHOBJ_CFLAGS=-fpic
SHOBJ_LD=ld
SHOBJ_LDFLAGS='-x -Bshareable'
@@ -125,7 +125,7 @@ freebsd2* | netbsd*)
# FreeBSD-3.x ELF
freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*)
- SHOBJ_CFLAGS=-fpic
+ SHOBJ_CFLAGS=-fPIC
SHOBJ_LD='${CC}'
if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
@@ -142,7 +142,7 @@ freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*)
;;
# Darwin/MacOS X
-darwin8*)
+darwin[89]*)
SHOBJ_STATUS=supported
SHLIB_STATUS=supported
@@ -153,7 +153,7 @@ darwin8*)
SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
SHLIB_LIBSUFF='dylib'
- SHOBJ_LDFLAGS='-undefined dynamic_lookup'
+ SHOBJ_LDFLAGS='-dynamiclib -dynamic -undefined dynamic_lookup -arch_only `/usr/bin/arch`'
SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1
@@ -171,7 +171,7 @@ darwin*|macosx*)
SHLIB_LIBSUFF='dylib'
case "${host_os}" in
- darwin[78]*) SHOBJ_LDFLAGS=''
+ darwin[789]*) SHOBJ_LDFLAGS=''
SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
;;
*) SHOBJ_LDFLAGS='-dynamic'
@@ -182,7 +182,7 @@ darwin*|macosx*)
SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1
;;
-openbsd*)
+openbsd*|netbsd*)
SHOBJ_CFLAGS=-fPIC
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared'
@@ -247,7 +247,7 @@ osf*)
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
-aix4.[2-9]*-*gcc*) # lightly tested by jik@cisco.com
+aix4.[2-9]*-*gcc*|aix[5-9].*-*gcc*) # lightly tested by jik@cisco.com
SHOBJ_CFLAGS=-fpic
SHOBJ_LD='ld'
SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
@@ -258,7 +258,7 @@ aix4.[2-9]*-*gcc*) # lightly tested by jik@cisco.com
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
-aix4.[2-9]*)
+aix4.[2-9]*|aix[5-9].*)
SHOBJ_CFLAGS=-K
SHOBJ_LD='ld'
SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
@@ -329,7 +329,7 @@ hpux10*-*gcc*)
SHOBJ_LD='${CC}'
# if you have problems linking here, moving the `-Wl,+h,$@' from
# SHLIB_XLDFLAGS to SHOBJ_LDFLAGS has been reported to work
- SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s'
+ SHOBJ_LDFLAGS='-shared -fpic -Wl,-b -Wl,+s'
SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)'
SHLIB_LIBSUFF='sl'
OpenPOWER on IntegriCloud