head 1.5; access; symbols pkgsrc-2013Q2:1.5.0.10 pkgsrc-2013Q2-base:1.5 pkgsrc-2012Q4:1.5.0.8 pkgsrc-2012Q4-base:1.5 pkgsrc-2011Q4:1.5.0.6 pkgsrc-2011Q4-base:1.5 pkgsrc-2011Q2:1.5.0.4 pkgsrc-2011Q2-base:1.5 pkgsrc-2009Q4:1.5.0.2 pkgsrc-2009Q4-base:1.5 pkgsrc-2008Q4:1.4.0.6 pkgsrc-2008Q4-base:1.4 pkgsrc-2008Q3:1.4.0.4 pkgsrc-2008Q3-base:1.4 cube-native-xorg:1.4.0.2 cube-native-xorg-base:1.4 pkgsrc-2008Q2:1.3.0.38 pkgsrc-2008Q2-base:1.3 pkgsrc-2008Q1:1.3.0.36 pkgsrc-2008Q1-base:1.3 pkgsrc-2007Q4:1.3.0.34 pkgsrc-2007Q4-base:1.3 pkgsrc-2007Q3:1.3.0.32 pkgsrc-2007Q3-base:1.3 pkgsrc-2007Q2:1.3.0.30 pkgsrc-2007Q2-base:1.3 pkgsrc-2007Q1:1.3.0.28 pkgsrc-2007Q1-base:1.3 pkgsrc-2006Q4:1.3.0.26 pkgsrc-2006Q4-base:1.3 pkgsrc-2006Q3:1.3.0.24 pkgsrc-2006Q3-base:1.3 pkgsrc-2006Q2:1.3.0.22 pkgsrc-2006Q2-base:1.3 pkgsrc-2006Q1:1.3.0.20 pkgsrc-2006Q1-base:1.3 pkgsrc-2005Q4:1.3.0.18 pkgsrc-2005Q4-base:1.3 pkgsrc-2005Q3:1.3.0.16 pkgsrc-2005Q3-base:1.3 pkgsrc-2005Q2:1.3.0.14 pkgsrc-2005Q2-base:1.3 pkgsrc-2005Q1:1.3.0.12 pkgsrc-2005Q1-base:1.3 pkgsrc-2004Q4:1.3.0.10 pkgsrc-2004Q4-base:1.3 pkgsrc-2004Q3:1.3.0.8 pkgsrc-2004Q3-base:1.3 pkgsrc-2004Q2:1.3.0.6 pkgsrc-2004Q2-base:1.3 pkgsrc-2004Q1:1.3.0.4 pkgsrc-2004Q1-base:1.3 pkgsrc-2003Q4:1.3.0.2 pkgsrc-2003Q4-base:1.3 buildlink2-base:1.3 netbsd-1-4-RELEASE:1.2 netbsd-1-3-PATCH003:1.2; locks; strict; comment @# @; 1.5 date 2009.02.23.12.35.46; author wiz; state dead; branches; next 1.4; 1.4 date 2008.08.13.11.11.38; author he; state Exp; branches; next 1.3; 1.3 date 99.07.13.00.56.13; author jlam; state dead; branches; next 1.2; 1.2 date 98.08.07.10.40.28; author agc; state Exp; branches; next 1.1; 1.1 date 98.07.23.12.10.14; author agc; state Exp; branches; next ; desc @@ 1.5 log @Update to 6.0: This is a terse description of the new features added to readline-6.0 since the release of readline-5.2. 1. New Features in Readline a. A new variable, rl_sort_completion_matches; allows applications to inhibit match list sorting (but beware: some things don't work right if applications do this). b. A new variable, rl_completion_invoking_key; allows applications to discover the key that invoked rl_complete or rl_menu_complete. c. The functions rl_block_sigint and rl_release_sigint are now public and available to calling applications who want to protect critical sections (like redisplay). d. The functions rl_save_state and rl_restore_state are now public and available to calling applications; documented rest of readline's state flag values. e. A new user-settable variable, `history-size', allows setting the maximum number of entries in the history list. f. There is a new implementation of menu completion, with several improvements over the old; the most notable improvement is a better `completions browsing' mode. g. The menu completion code now uses the rl_menu_completion_entry_function variable, allowing applications to provide their own menu completion generators. h. There is support for replacing a prefix of a pathname with a `...' when displaying possible completions. This is controllable by setting the `completion-prefix-display-length' variable. Matches with a common prefix longer than this value have the common prefix replaced with `...'. i. There is a new `revert-all-at-newline' variable. If enabled, readline will undo all outstanding changes to all history lines when `accept-line' is executed. @ text @$NetBSD: patch-af,v 1.4 2008/08/13 11:11:38 he Exp $ 3 patches from Debian rolled into one: http://lists.gnu.org/archive/html/bug-bash/2006-11/msg00017.html Bug-Description: In some cases, code that is intended to be used in the presence of multibyte characters is called when no such characters are present, leading to incorrect display position calculations and incorrect redisplay. http://lists.gnu.org/archive/html/bug-readline/2007-01/msg00002.html Bug-Description: Readline neglects to reallocate the array it uses to keep track of wrapped screen lines when increasing its size. This will eventually result in segmentation faults when given sufficiently long input. http://lists.gnu.org/archive/html/bug-bash/2007-02/msg00054.html Bug-Description: When moving the cursor, bash sometimes misplaces the cursor when the prompt contains two or more multibyte characters. The particular circumstance that uncovered the problem was having the (multibyte) current directory name in the prompt string. --- display.c.orig 2006-09-14 20:20:12.000000000 +0200 +++ display.c @@@@ -561,14 +561,25 @@@@ rl_redisplay () wrap_offset = prompt_invis_chars_first_line = 0; } +#if defined (HANDLE_MULTIBYTE) #define CHECK_INV_LBREAKS() \ do { \ if (newlines >= (inv_lbsize - 2)) \ { \ inv_lbsize *= 2; \ inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \ + _rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \ + } \ + } while (0) +#else + do { \ + if (newlines >= (inv_lbsize - 2)) \ + { \ + inv_lbsize *= 2; \ + inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \ } \ } while (0) +#endif /* HANDLE_MULTIBYTE */ #if defined (HANDLE_MULTIBYTE) #define CHECK_LPOS() \ @@@@ -1586,8 +1597,22 @@@@ update_line (old, new, current_line, oma temp = nls - nfd; if (temp > 0) { + /* If nfd begins at the prompt, or before the invisible + characters in the prompt, we need to adjust _rl_last_c_pos + in a multibyte locale to account for the wrap offset and + set cpos_adjusted accordingly. */ _rl_output_some_chars (nfd, temp); - _rl_last_c_pos += _rl_col_width (nfd, 0, temp);; + if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) + { + _rl_last_c_pos += _rl_col_width (nfd, 0, temp); + if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) + { + _rl_last_c_pos -= wrap_offset; + cpos_adjusted = 1; + } + } + else + _rl_last_c_pos += temp; } } /* Otherwise, print over the existing material. */ @@@@ -1595,8 +1620,20 @@@@ update_line (old, new, current_line, oma { if (temp > 0) { + /* If nfd begins at the prompt, or before the invisible + characters in the prompt, we need to adjust _rl_last_c_pos + in a multibyte locale to account for the wrap offset and + set cpos_adjusted accordingly. */ _rl_output_some_chars (nfd, temp); _rl_last_c_pos += col_temp; /* XXX */ + if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) + { + if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) + { + _rl_last_c_pos -= wrap_offset; + cpos_adjusted = 1; + } + } } lendiff = (oe - old) - (ne - new); if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) @@@@ -1732,7 +1769,10 @@@@ _rl_move_cursor_relative (new, data) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) { dpos = _rl_col_width (data, 0, new); - if (dpos > prompt_last_invisible) /* XXX - don't use woff here */ + /* 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 */ { dpos -= woff; /* Since this will be assigned to _rl_last_c_pos at the end (more @@@@ -2380,6 +2420,8 @@@@ _rl_col_width (str, start, end) if (end <= start) return 0; + if (MB_CUR_MAX == 1) + return end - start; memset (&ps, 0, sizeof (mbstate_t)); @ 1.4 log @Update from version 5.2nb1 to 5.2nb2. This imports some fixes from Debian. First and foremost: http://lists.gnu.org/archive/html/bug-bash/2006-11/msg00017.html Bug-Description: In some cases, code that is intended to be used in the presence of multibyte characters is called when no such characters are present, leading to incorrect display position calculations and incorrect redisplay. http://lists.gnu.org/archive/html/bug-readline/2007-01/msg00002.html Bug-Description: Readline neglects to reallocate the array it uses to keep track of wrapped screen lines when increasing its size. This will eventually result in segmentation faults when given sufficiently long input. http://lists.gnu.org/archive/html/bug-bash/2007-02/msg00054.html Bug-Description: When moving the cursor, bash sometimes misplaces the cursor when the prompt contains two or more multibyte characters. The particular circumstance that uncovered the problem was having the (multibyte) current directory name in the prompt string. ...all related to display.c. Also add include of to two of the readline header files. @ text @d1 1 a1 1 $NetBSD$ @ 1.3 log @ * Update "devel/readline" to 4.0. * Libtoolize library build. @ text @d1 1 a1 1 $NetBSD: patch-af,v 1.2 1998/08/07 10:40:28 agc Exp $ d3 119 a121 5 --- history.h Thu Jul 23 12:13:23 1998 +++ history.h Thu May 22 22:37:53 1997 @@@@ -22,6 +22,10 @@@@ #ifndef _HISTORY_H_ #define _HISTORY_H_ d123 1 a123 15 +#ifdef __cplusplus +extern "C" { +#endif + #if !defined (_FUNCTION_DEF) # define _FUNCTION_DEF typedef int Function (); @@@@ -219,5 +223,9 @@@@ history expansion should be treated as a special case for the calling application and not expanded. */ extern Function *history_inhibit_expansion_function; + +#ifdef __cplusplus +} +#endif a124 1 #endif /* !_HISTORY_H_ */ @ 1.2 log @Add NetBSD RCS Ids. @ text @d1 1 a1 1 $NetBSD$ @ 1.1 log @Use an ``extern "C"'' style block in case the history.h file is included in a C++ application. @ text @d1 2 @