source: clfs-sysroot/patches/readline-5.2-fixes-2.patch@ 84e7860

Last change on this file since 84e7860 was ff91a87, checked in by Joe Ciccone <jciccone@…>, 17 years ago

Updated the readline fixes patch.

  • Property mode set to 100644
File size: 3.3 KB
RevLine 
[ff91a87]1Submitted By: Joe Ciccone <jciccone@gmail.com>
2Date: 2007-07-23
3Initial Package Version: 5.2
4Origin: ftp://ftp.cwru.edu/pub/bash/readline-5.2-patches
5Upstream Status: From Upstream
6Description: Contains patches 001 - 004 from upstream
7
8diff -Naur readline-5.2.orig/display.c readline-5.2/display.c
9--- readline-5.2.orig/display.c 2007-07-23 20:10:10.000000000 -0400
10+++ readline-5.2/display.c 2007-07-23 20:10:27.000000000 -0400
11@@ -561,6 +561,17 @@
12 wrap_offset = prompt_invis_chars_first_line = 0;
13 }
14
15+#if defined (HANDLE_MULTIBYTE)
16+#define CHECK_INV_LBREAKS() \
17+ do { \
18+ if (newlines >= (inv_lbsize - 2)) \
19+ { \
20+ inv_lbsize *= 2; \
21+ inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
22+ _rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \
23+ } \
24+ } while (0)
25+#else
26 #define CHECK_INV_LBREAKS() \
27 do { \
28 if (newlines >= (inv_lbsize - 2)) \
29@@ -569,6 +580,7 @@
30 inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
31 } \
32 } while (0)
33+#endif /* HANDLE_MULTIBYTE */
34
35 #if defined (HANDLE_MULTIBYTE)
36 #define CHECK_LPOS() \
37@@ -1586,8 +1598,22 @@
38 temp = nls - nfd;
39 if (temp > 0)
40 {
41+ /* If nfd begins at the prompt, or before the invisible
42+ characters in the prompt, we need to adjust _rl_last_c_pos
43+ in a multibyte locale to account for the wrap offset and
44+ set cpos_adjusted accordingly. */
45 _rl_output_some_chars (nfd, temp);
46- _rl_last_c_pos += _rl_col_width (nfd, 0, temp);;
47+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
48+ {
49+ _rl_last_c_pos += _rl_col_width (nfd, 0, temp);
50+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
51+ {
52+ _rl_last_c_pos -= wrap_offset;
53+ cpos_adjusted = 1;
54+ }
55+ }
56+ else
57+ _rl_last_c_pos += temp;
58 }
59 }
60 /* Otherwise, print over the existing material. */
61@@ -1595,8 +1621,20 @@
62 {
63 if (temp > 0)
64 {
65+ /* If nfd begins at the prompt, or before the invisible
66+ characters in the prompt, we need to adjust _rl_last_c_pos
67+ in a multibyte locale to account for the wrap offset and
68+ set cpos_adjusted accordingly. */
69 _rl_output_some_chars (nfd, temp);
70 _rl_last_c_pos += col_temp; /* XXX */
71+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
72+ {
73+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
74+ {
75+ _rl_last_c_pos -= wrap_offset;
76+ cpos_adjusted = 1;
77+ }
78+ }
79 }
80 lendiff = (oe - old) - (ne - new);
81 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
82@@ -1732,7 +1770,10 @@
83 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
84 {
85 dpos = _rl_col_width (data, 0, new);
86- if (dpos > prompt_last_invisible) /* XXX - don't use woff here */
87+ /* Use NEW when comparing against the last invisible character in the
88+ prompt string, since they're both buffer indices and DPOS is a
89+ desired display position. */
90+ if (new > prompt_last_invisible) /* XXX - don't use woff here */
91 {
92 dpos -= woff;
93 /* Since this will be assigned to _rl_last_c_pos at the end (more
94@@ -2380,6 +2421,8 @@
95
96 if (end <= start)
97 return 0;
98+ if (MB_CUR_MAX == 1 || rl_byte_oriented)
99+ return (end - start);
100
101 memset (&ps, 0, sizeof (mbstate_t));
102
Note: See TracBrowser for help on using the repository browser.