]>
Commit | Line | Data |
---|---|---|
4e9fe84f JB |
1 | BASH PATCH REPORT |
2 | ================= | |
3 | ||
4 | Bash-Release: 3.0 | |
5 | Patch-ID: bash30-006 | |
6 | ||
7 | Bug-Reported-by: alexander@skwar.name | |
8 | Tomohiro KUBOTA <debian@tmail.plala.or.jp> | |
9 | Bug-Reference-ID: <20040801124721.C69B8A2547A@server.bei.digitalprojects.com> | |
10 | <16688.41450.433668.480445@gargle.gargle.HOWL> | |
11 | Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2004-08/msg00006.html | |
12 | http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=257540 | |
13 | ||
14 | Bug-Description: | |
15 | ||
16 | Prompts with multibyte characters or invisible characters following a line | |
17 | wrap are displayed incorrectly. | |
18 | ||
19 | Patch: | |
20 | ||
21 | *** ../bash-3.0/lib/readline/display.c Thu May 27 22:57:51 2004 | |
22 | --- lib/readline/display.c Mon Aug 30 11:55:02 2004 | |
23 | *************** | |
24 | *** 202,206 **** | |
25 | { | |
26 | char *r, *ret, *p; | |
27 | ! int l, rl, last, ignoring, ninvis, invfl, ind, pind, physchars; | |
28 | ||
29 | /* Short-circuit if we can. */ | |
30 | --- 202,206 ---- | |
31 | { | |
32 | char *r, *ret, *p; | |
33 | ! int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars; | |
34 | ||
35 | /* Short-circuit if we can. */ | |
36 | *************** | |
37 | *** 223,226 **** | |
38 | --- 223,227 ---- | |
39 | ||
40 | invfl = 0; /* invisible chars in first line of prompt */ | |
41 | + invflset = 0; /* we only want to set invfl once */ | |
42 | ||
43 | for (rl = ignoring = last = ninvis = physchars = 0, p = pmt; p && *p; p++) | |
44 | *************** | |
45 | *** 250,254 **** | |
46 | *r++ = *p++; | |
47 | if (!ignoring) | |
48 | ! rl += ind - pind; | |
49 | else | |
50 | ninvis += ind - pind; | |
51 | --- 251,258 ---- | |
52 | *r++ = *p++; | |
53 | if (!ignoring) | |
54 | ! { | |
55 | ! rl += ind - pind; | |
56 | ! physchars += _rl_col_width (pmt, pind, ind); | |
57 | ! } | |
58 | else | |
59 | ninvis += ind - pind; | |
60 | *************** | |
61 | *** 260,273 **** | |
62 | *r++ = *p; | |
63 | if (!ignoring) | |
64 | ! rl++; /* visible length byte counter */ | |
65 | else | |
66 | ninvis++; /* invisible chars byte counter */ | |
67 | } | |
68 | ||
69 | ! if (rl >= _rl_screenwidth) | |
70 | ! invfl = ninvis; | |
71 | ! | |
72 | ! if (ignoring == 0) | |
73 | ! physchars++; | |
74 | } | |
75 | } | |
76 | --- 264,280 ---- | |
77 | *r++ = *p; | |
78 | if (!ignoring) | |
79 | ! { | |
80 | ! rl++; /* visible length byte counter */ | |
81 | ! physchars++; | |
82 | ! } | |
83 | else | |
84 | ninvis++; /* invisible chars byte counter */ | |
85 | } | |
86 | ||
87 | ! if (invflset == 0 && rl >= _rl_screenwidth) | |
88 | ! { | |
89 | ! invfl = ninvis; | |
90 | ! invflset = 1; | |
91 | ! } | |
92 | } | |
93 | } | |
94 | *************** | |
95 | *** 418,422 **** | |
96 | register char *line; | |
97 | int c_pos, inv_botlin, lb_botlin, lb_linenum; | |
98 | ! int newlines, lpos, temp, modmark; | |
99 | char *prompt_this_line; | |
100 | #if defined (HANDLE_MULTIBYTE) | |
101 | --- 425,429 ---- | |
102 | register char *line; | |
103 | int c_pos, inv_botlin, lb_botlin, lb_linenum; | |
104 | ! int newlines, lpos, temp, modmark, n0, num; | |
105 | char *prompt_this_line; | |
106 | #if defined (HANDLE_MULTIBYTE) | |
107 | *************** | |
108 | *** 574,577 **** | |
109 | --- 581,585 ---- | |
110 | #if defined (HANDLE_MULTIBYTE) | |
111 | memset (_rl_wrapped_line, 0, vis_lbsize); | |
112 | + num = 0; | |
113 | #endif | |
114 | ||
115 | *************** | |
116 | *** 592,596 **** | |
117 | --- 600,619 ---- | |
118 | prompts that exceed two physical lines? | |
119 | Additional logic fix from Edward Catmur <ed@catmur.co.uk> */ | |
120 | + #if defined (HANDLE_MULTIBYTE) | |
121 | + n0 = num; | |
122 | + temp = local_prompt ? strlen (local_prompt) : 0; | |
123 | + while (num < temp) | |
124 | + { | |
125 | + if (_rl_col_width (local_prompt, n0, num) > _rl_screenwidth) | |
126 | + { | |
127 | + num = _rl_find_prev_mbchar (local_prompt, num, MB_FIND_ANY); | |
128 | + break; | |
129 | + } | |
130 | + num++; | |
131 | + } | |
132 | + temp = num + | |
133 | + #else | |
134 | temp = ((newlines + 1) * _rl_screenwidth) + | |
135 | + #endif /* !HANDLE_MULTIBYTE */ | |
136 | ((local_prompt_prefix == 0) ? ((newlines == 0) ? prompt_invis_chars_first_line | |
137 | : ((newlines == 1) ? wrap_offset : 0)) | |
138 | *************** | |
139 | *** 598,602 **** | |
140 | --- 621,629 ---- | |
141 | ||
142 | inv_lbreaks[++newlines] = temp; | |
143 | + #if defined (HANDLE_MULTIBYTE) | |
144 | + lpos -= _rl_col_width (local_prompt, n0, num); | |
145 | + #else | |
146 | lpos -= _rl_screenwidth; | |
147 | + #endif | |
148 | } | |
149 | ||
150 | ||
151 | *** ../bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001 | |
152 | --- patchlevel.h Thu Sep 2 15:04:32 2004 | |
153 | *************** | |
154 | *** 26,30 **** | |
155 | looks for to find the patch level (for the sccs version string). */ | |
156 | ||
157 | ! #define PATCHLEVEL 5 | |
158 | ||
159 | #endif /* _PATCHLEVEL_H_ */ | |
160 | --- 26,30 ---- | |
161 | looks for to find the patch level (for the sccs version string). */ | |
162 | ||
163 | ! #define PATCHLEVEL 6 | |
164 | ||
165 | #endif /* _PATCHLEVEL_H_ */ |