| 1 | READLINE PATCH REPORT |
| 2 | ===================== |
| 3 | |
| 4 | Readline-Release: 5.2 |
| 5 | Patch-ID: readline52-001 |
| 6 | |
| 7 | Bug-Reported-by: ebb9@byu.net |
| 8 | Bug-Reference-ID: <45540862.9030900@byu.net> |
| 9 | Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2006-11/msg00017.html |
| 10 | http://lists.gnu.org/archive/html/bug-bash/2006-11/msg00016.html |
| 11 | |
| 12 | Bug-Description: |
| 13 | |
| 14 | In some cases, code that is intended to be used in the presence of multibyte |
| 15 | characters is called when no such characters are present, leading to incorrect |
| 16 | display position calculations and incorrect redisplay. |
| 17 | |
| 18 | Patch: |
| 19 | |
| 20 | *** ../readline-5.2/display.c Thu Sep 14 14:20:12 2006 |
| 21 | --- display.c Mon Nov 13 17:55:57 2006 |
| 22 | *************** |
| 23 | *** 2381,2384 **** |
| 24 | --- 2409,2414 ---- |
| 25 | if (end <= start) |
| 26 | return 0; |
| 27 | + if (MB_CUR_MAX == 1 || rl_byte_oriented) |
| 28 | + return (end - start); |
| 29 | |
| 30 | memset (&ps, 0, sizeof (mbstate_t)); |
| 31 | |
| 32 | READLINE PATCH REPORT |
| 33 | ===================== |
| 34 | |
| 35 | Readline-Release: 5.2 |
| 36 | Patch-ID: readline52-002 |
| 37 | |
| 38 | Bug-Reported-by: Magnus Svensson <msvensson@mysql.com> |
| 39 | Bug-Reference-ID: <45BDC44D.80609@mysql.com> |
| 40 | Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2007-01/msg00002.html |
| 41 | |
| 42 | Bug-Description: |
| 43 | |
| 44 | Readline neglects to reallocate the array it uses to keep track of wrapped |
| 45 | screen lines when increasing its size. This will eventually result in |
| 46 | segmentation faults when given sufficiently long input. |
| 47 | |
| 48 | Patch: |
| 49 | |
| 50 | *** ../readline-5.2-patched/display.c Thu Sep 14 14:20:12 2006 |
| 51 | --- display.c Fri Feb 2 20:23:17 2007 |
| 52 | *************** |
| 53 | *** 561,574 **** |
| 54 | --- 561,586 ---- |
| 55 | wrap_offset = prompt_invis_chars_first_line = 0; |
| 56 | } |
| 57 | |
| 58 | + #if defined (HANDLE_MULTIBYTE) |
| 59 | #define CHECK_INV_LBREAKS() \ |
| 60 | do { \ |
| 61 | if (newlines >= (inv_lbsize - 2)) \ |
| 62 | { \ |
| 63 | inv_lbsize *= 2; \ |
| 64 | inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \ |
| 65 | + _rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \ |
| 66 | } \ |
| 67 | } while (0) |
| 68 | + #else |
| 69 | + #define CHECK_INV_LBREAKS() \ |
| 70 | + do { \ |
| 71 | + if (newlines >= (inv_lbsize - 2)) \ |
| 72 | + { \ |
| 73 | + inv_lbsize *= 2; \ |
| 74 | + inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \ |
| 75 | + } \ |
| 76 | + } while (0) |
| 77 | + #endif /* HANDLE_MULTIBYTE */ |
| 78 | |
| 79 | #if defined (HANDLE_MULTIBYTE) |
| 80 | #define CHECK_LPOS() \ |
| 81 | |
| 82 | READLINE PATCH REPORT |
| 83 | ===================== |
| 84 | |
| 85 | Readline-Release: 5.2 |
| 86 | Patch-ID: readline52-003 |
| 87 | |
| 88 | Bug-Reported-by: Peter Volkov <torre_cremata@mail.ru> |
| 89 | Bug-Reference-ID: <1171795523.8021.18.camel@localhost> |
| 90 | Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2007-02/msg00054.html |
| 91 | |
| 92 | Bug-Description: |
| 93 | |
| 94 | When moving the cursor, bash sometimes misplaces the cursor when the prompt |
| 95 | contains two or more multibyte characters. The particular circumstance that |
| 96 | uncovered the problem was having the (multibyte) current directory name in |
| 97 | the prompt string. |
| 98 | |
| 99 | Patch: |
| 100 | |
| 101 | *** ../readline-5.2.2/display.c Fri Jan 19 13:34:50 2007 |
| 102 | --- display.c Sat Mar 10 17:25:44 2007 |
| 103 | *************** |
| 104 | *** 1745,1749 **** |
| 105 | { |
| 106 | dpos = _rl_col_width (data, 0, new); |
| 107 | ! if (dpos > prompt_last_invisible) /* XXX - don't use woff here */ |
| 108 | { |
| 109 | dpos -= woff; |
| 110 | --- 1745,1752 ---- |
| 111 | { |
| 112 | dpos = _rl_col_width (data, 0, new); |
| 113 | ! /* Use NEW when comparing against the last invisible character in the |
| 114 | ! prompt string, since they're both buffer indices and DPOS is a |
| 115 | ! desired display position. */ |
| 116 | ! if (new > prompt_last_invisible) /* XXX - don't use woff here */ |
| 117 | { |
| 118 | dpos -= woff; |
| 119 | |
| 120 | READLINE PATCH REPORT |
| 121 | ===================== |
| 122 | |
| 123 | Readline-Release: 5.2 |
| 124 | Patch-ID: readline52-004 |
| 125 | |
| 126 | Bug-Reported-by: Peter Volkov <torre_cremata@mail.ru> |
| 127 | Bug-Reference-ID: <1173636022.7039.36.camel@localhost> |
| 128 | Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2007-03/msg00039.html |
| 129 | |
| 130 | Bug-Description: |
| 131 | |
| 132 | When restoring the original prompt after finishing an incremental search, |
| 133 | bash sometimes places the cursor incorrectly if the primary prompt contains |
| 134 | invisible characters. |
| 135 | |
| 136 | Patch: |
| 137 | |
| 138 | *** ../readline-5.2.3/display.c Fri Apr 20 13:30:16 2007 |
| 139 | --- display.c Fri Apr 20 15:17:01 2007 |
| 140 | *************** |
| 141 | *** 1599,1604 **** |
| 142 | if (temp > 0) |
| 143 | { |
| 144 | _rl_output_some_chars (nfd, temp); |
| 145 | ! _rl_last_c_pos += _rl_col_width (nfd, 0, temp);; |
| 146 | } |
| 147 | } |
| 148 | --- 1599,1618 ---- |
| 149 | if (temp > 0) |
| 150 | { |
| 151 | + /* If nfd begins at the prompt, or before the invisible |
| 152 | + characters in the prompt, we need to adjust _rl_last_c_pos |
| 153 | + in a multibyte locale to account for the wrap offset and |
| 154 | + set cpos_adjusted accordingly. */ |
| 155 | _rl_output_some_chars (nfd, temp); |
| 156 | ! if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) |
| 157 | ! { |
| 158 | ! _rl_last_c_pos += _rl_col_width (nfd, 0, temp); |
| 159 | ! if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) |
| 160 | ! { |
| 161 | ! _rl_last_c_pos -= wrap_offset; |
| 162 | ! cpos_adjusted = 1; |
| 163 | ! } |
| 164 | ! } |
| 165 | ! else |
| 166 | ! _rl_last_c_pos += temp; |
| 167 | } |
| 168 | } |
| 169 | *************** |
| 170 | *** 1608,1613 **** |
| 171 | --- 1622,1639 ---- |
| 172 | if (temp > 0) |
| 173 | { |
| 174 | + /* If nfd begins at the prompt, or before the invisible |
| 175 | + characters in the prompt, we need to adjust _rl_last_c_pos |
| 176 | + in a multibyte locale to account for the wrap offset and |
| 177 | + set cpos_adjusted accordingly. */ |
| 178 | _rl_output_some_chars (nfd, temp); |
| 179 | _rl_last_c_pos += col_temp; /* XXX */ |
| 180 | + if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) |
| 181 | + { |
| 182 | + if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) |
| 183 | + { |
| 184 | + _rl_last_c_pos -= wrap_offset; |
| 185 | + cpos_adjusted = 1; |
| 186 | + } |
| 187 | + } |
| 188 | } |
| 189 | lendiff = (oe - old) - (ne - new); |
| 190 | |
| 191 | READLINE PATCH REPORT |
| 192 | ===================== |
| 193 | |
| 194 | Readline-Release: 5.2 |
| 195 | Patch-ID: readline52-005 |
| 196 | |
| 197 | Bug-Reported-by: Thomas Loeber <ifp@loeber1.de> |
| 198 | Bug-Reference-ID: <200703082223.08919.ifp@loeber1.de> |
| 199 | Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2007-03/msg00036.html |
| 200 | |
| 201 | Bug-Description: |
| 202 | |
| 203 | When rl_read_key returns -1, indicating that readline's controlling terminal |
| 204 | has been invalidated for some reason (e.g., receiving a SIGHUP), the error |
| 205 | status was not reported correctly to the caller. This could cause input |
| 206 | loops. |
| 207 | |
| 208 | Patch: |
| 209 | |
| 210 | *** ../readline-5.2/complete.c Fri Jul 28 11:35:49 2006 |
| 211 | --- complete.c Tue Mar 13 08:50:16 2007 |
| 212 | *************** |
| 213 | *** 429,433 **** |
| 214 | if (c == 'n' || c == 'N' || c == RUBOUT) |
| 215 | return (0); |
| 216 | ! if (c == ABORT_CHAR) |
| 217 | _rl_abort_internal (); |
| 218 | if (for_pager && (c == NEWLINE || c == RETURN)) |
| 219 | --- 440,444 ---- |
| 220 | if (c == 'n' || c == 'N' || c == RUBOUT) |
| 221 | return (0); |
| 222 | ! if (c == ABORT_CHAR || c < 0) |
| 223 | _rl_abort_internal (); |
| 224 | if (for_pager && (c == NEWLINE || c == RETURN)) |
| 225 | *** ../readline-5.2/input.c Wed Aug 16 15:15:16 2006 |
| 226 | --- input.c Wed May 2 16:07:59 2007 |
| 227 | *************** |
| 228 | *** 514,518 **** |
| 229 | int size; |
| 230 | { |
| 231 | ! int mb_len = 0; |
| 232 | size_t mbchar_bytes_length; |
| 233 | wchar_t wc; |
| 234 | --- 522,526 ---- |
| 235 | int size; |
| 236 | { |
| 237 | ! int mb_len, c; |
| 238 | size_t mbchar_bytes_length; |
| 239 | wchar_t wc; |
| 240 | *************** |
| 241 | *** 521,531 **** |
| 242 | memset(&ps, 0, sizeof (mbstate_t)); |
| 243 | memset(&ps_back, 0, sizeof (mbstate_t)); |
| 244 | ! |
| 245 | while (mb_len < size) |
| 246 | { |
| 247 | RL_SETSTATE(RL_STATE_MOREINPUT); |
| 248 | ! mbchar[mb_len++] = rl_read_key (); |
| 249 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
| 250 | |
| 251 | mbchar_bytes_length = mbrtowc (&wc, mbchar, mb_len, &ps); |
| 252 | if (mbchar_bytes_length == (size_t)(-1)) |
| 253 | --- 529,545 ---- |
| 254 | memset(&ps, 0, sizeof (mbstate_t)); |
| 255 | memset(&ps_back, 0, sizeof (mbstate_t)); |
| 256 | ! |
| 257 | ! mb_len = 0; |
| 258 | while (mb_len < size) |
| 259 | { |
| 260 | RL_SETSTATE(RL_STATE_MOREINPUT); |
| 261 | ! c = rl_read_key (); |
| 262 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
| 263 | |
| 264 | + if (c < 0) |
| 265 | + break; |
| 266 | + |
| 267 | + mbchar[mb_len++] = c; |
| 268 | + |
| 269 | mbchar_bytes_length = mbrtowc (&wc, mbchar, mb_len, &ps); |
| 270 | if (mbchar_bytes_length == (size_t)(-1)) |
| 271 | *************** |
| 272 | *** 565,569 **** |
| 273 | c = first; |
| 274 | memset (mb, 0, mlen); |
| 275 | ! for (i = 0; i < mlen; i++) |
| 276 | { |
| 277 | mb[i] = (char)c; |
| 278 | --- 579,583 ---- |
| 279 | c = first; |
| 280 | memset (mb, 0, mlen); |
| 281 | ! for (i = 0; c >= 0 && i < mlen; i++) |
| 282 | { |
| 283 | mb[i] = (char)c; |
| 284 | *** ../readline-5.2/isearch.c Mon Dec 26 17:18:53 2005 |
| 285 | --- isearch.c Fri Mar 9 14:30:59 2007 |
| 286 | *************** |
| 287 | *** 328,333 **** |
| 288 | |
| 289 | f = (rl_command_func_t *)NULL; |
| 290 | ! |
| 291 | ! /* Translate the keys we do something with to opcodes. */ |
| 292 | if (c >= 0 && _rl_keymap[c].type == ISFUNC) |
| 293 | { |
| 294 | --- 328,340 ---- |
| 295 | |
| 296 | f = (rl_command_func_t *)NULL; |
| 297 | ! |
| 298 | ! if (c < 0) |
| 299 | ! { |
| 300 | ! cxt->sflags |= SF_FAILED; |
| 301 | ! cxt->history_pos = cxt->last_found_line; |
| 302 | ! return -1; |
| 303 | ! } |
| 304 | ! |
| 305 | ! /* Translate the keys we do something with to opcodes. */ |
| 306 | if (c >= 0 && _rl_keymap[c].type == ISFUNC) |
| 307 | { |
| 308 | *** ../readline-5.2/misc.c Mon Dec 26 17:20:46 2005 |
| 309 | --- misc.c Fri Mar 9 14:44:11 2007 |
| 310 | *************** |
| 311 | *** 147,150 **** |
| 312 | --- 147,152 ---- |
| 313 | rl_clear_message (); |
| 314 | RL_UNSETSTATE(RL_STATE_NUMERICARG); |
| 315 | + if (key < 0) |
| 316 | + return -1; |
| 317 | return (_rl_dispatch (key, _rl_keymap)); |
| 318 | } |
| 319 | *** ../readline-5.2/readline.c Wed Aug 16 15:00:36 2006 |
| 320 | --- readline.c Fri Mar 9 14:47:24 2007 |
| 321 | *************** |
| 322 | *** 646,649 **** |
| 323 | --- 669,677 ---- |
| 324 | { |
| 325 | nkey = _rl_subseq_getchar (cxt->okey); |
| 326 | + if (nkey < 0) |
| 327 | + { |
| 328 | + _rl_abort_internal (); |
| 329 | + return -1; |
| 330 | + } |
| 331 | r = _rl_dispatch_subseq (nkey, cxt->dmap, cxt->subseq_arg); |
| 332 | cxt->flags |= KSEQ_DISPATCHED; |
| 333 | *** ../readline-5.2/text.c Fri Jul 28 11:55:27 2006 |
| 334 | --- text.c Sun Mar 25 13:41:38 2007 |
| 335 | *************** |
| 336 | *** 858,861 **** |
| 337 | --- 864,870 ---- |
| 338 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
| 339 | |
| 340 | + if (c < 0) |
| 341 | + return -1; |
| 342 | + |
| 343 | #if defined (HANDLE_SIGNALS) |
| 344 | if (RL_ISSTATE (RL_STATE_CALLBACK) == 0) |
| 345 | *************** |
| 346 | *** 1521,1524 **** |
| 347 | --- 1530,1536 ---- |
| 348 | mb_len = _rl_read_mbchar (mbchar, MB_LEN_MAX); |
| 349 | |
| 350 | + if (mb_len <= 0) |
| 351 | + return -1; |
| 352 | + |
| 353 | if (count < 0) |
| 354 | return (_rl_char_search_internal (-count, bdir, mbchar, mb_len)); |
| 355 | *************** |
| 356 | *** 1537,1540 **** |
| 357 | --- 1549,1555 ---- |
| 358 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
| 359 | |
| 360 | + if (c < 0) |
| 361 | + return -1; |
| 362 | + |
| 363 | if (count < 0) |
| 364 | return (_rl_char_search_internal (-count, bdir, c)); |
| 365 | *** ../readline-5.2/vi_mode.c Sat Jul 29 16:42:28 2006 |
| 366 | --- vi_mode.c Fri Mar 9 15:02:11 2007 |
| 367 | *************** |
| 368 | *** 887,890 **** |
| 369 | --- 887,897 ---- |
| 370 | c = rl_read_key (); |
| 371 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
| 372 | + |
| 373 | + if (c < 0) |
| 374 | + { |
| 375 | + *nextkey = 0; |
| 376 | + return -1; |
| 377 | + } |
| 378 | + |
| 379 | *nextkey = c; |
| 380 | |
| 381 | *************** |
| 382 | *** 903,906 **** |
| 383 | --- 910,918 ---- |
| 384 | c = rl_read_key (); /* real command */ |
| 385 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
| 386 | + if (c < 0) |
| 387 | + { |
| 388 | + *nextkey = 0; |
| 389 | + return -1; |
| 390 | + } |
| 391 | *nextkey = c; |
| 392 | } |
| 393 | *************** |
| 394 | *** 1225,1236 **** |
| 395 | _rl_callback_generic_arg *data; |
| 396 | { |
| 397 | #if defined (HANDLE_MULTIBYTE) |
| 398 | ! _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX); |
| 399 | #else |
| 400 | RL_SETSTATE(RL_STATE_MOREINPUT); |
| 401 | ! _rl_vi_last_search_char = rl_read_key (); |
| 402 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
| 403 | #endif |
| 404 | |
| 405 | _rl_callback_func = 0; |
| 406 | _rl_want_redisplay = 1; |
| 407 | --- 1243,1262 ---- |
| 408 | _rl_callback_generic_arg *data; |
| 409 | { |
| 410 | + int c; |
| 411 | #if defined (HANDLE_MULTIBYTE) |
| 412 | ! c = _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX); |
| 413 | #else |
| 414 | RL_SETSTATE(RL_STATE_MOREINPUT); |
| 415 | ! c = rl_read_key (); |
| 416 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
| 417 | #endif |
| 418 | |
| 419 | + if (c <= 0) |
| 420 | + return -1; |
| 421 | + |
| 422 | + #if !defined (HANDLE_MULTIBYTE) |
| 423 | + _rl_vi_last_search_char = c; |
| 424 | + #endif |
| 425 | + |
| 426 | _rl_callback_func = 0; |
| 427 | _rl_want_redisplay = 1; |
| 428 | *************** |
| 429 | *** 1248,1251 **** |
| 430 | --- 1274,1278 ---- |
| 431 | int count, key; |
| 432 | { |
| 433 | + int c; |
| 434 | #if defined (HANDLE_MULTIBYTE) |
| 435 | static char *target; |
| 436 | *************** |
| 437 | *** 1294,1302 **** |
| 438 | { |
| 439 | #if defined (HANDLE_MULTIBYTE) |
| 440 | ! _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX); |
| 441 | #else |
| 442 | RL_SETSTATE(RL_STATE_MOREINPUT); |
| 443 | ! _rl_vi_last_search_char = rl_read_key (); |
| 444 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
| 445 | #endif |
| 446 | } |
| 447 | --- 1321,1335 ---- |
| 448 | { |
| 449 | #if defined (HANDLE_MULTIBYTE) |
| 450 | ! c = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX); |
| 451 | ! if (c <= 0) |
| 452 | ! return -1; |
| 453 | ! _rl_vi_last_search_mblen = c; |
| 454 | #else |
| 455 | RL_SETSTATE(RL_STATE_MOREINPUT); |
| 456 | ! c = rl_read_key (); |
| 457 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
| 458 | + if (c < 0) |
| 459 | + return -1; |
| 460 | + _rl_vi_last_search_char = c; |
| 461 | #endif |
| 462 | } |
| 463 | *************** |
| 464 | *** 1468,1471 **** |
| 465 | --- 1501,1507 ---- |
| 466 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
| 467 | |
| 468 | + if (c < 0) |
| 469 | + return -1; |
| 470 | + |
| 471 | #if defined (HANDLE_MULTIBYTE) |
| 472 | if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) |
| 473 | *************** |
| 474 | *** 1486,1489 **** |
| 475 | --- 1522,1528 ---- |
| 476 | _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX); |
| 477 | |
| 478 | + if (c < 0) |
| 479 | + return -1; |
| 480 | + |
| 481 | _rl_callback_func = 0; |
| 482 | _rl_want_redisplay = 1; |
| 483 | *************** |
| 484 | *** 1517,1520 **** |
| 485 | --- 1556,1562 ---- |
| 486 | _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX); |
| 487 | |
| 488 | + if (c < 0) |
| 489 | + return -1; |
| 490 | + |
| 491 | return (_rl_vi_change_char (count, c, mb)); |
| 492 | } |
| 493 | *************** |
| 494 | *** 1651,1655 **** |
| 495 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
| 496 | |
| 497 | ! if (ch < 'a' || ch > 'z') |
| 498 | { |
| 499 | rl_ding (); |
| 500 | --- 1693,1697 ---- |
| 501 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
| 502 | |
| 503 | ! if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */ |
| 504 | { |
| 505 | rl_ding (); |
| 506 | *************** |
| 507 | *** 1703,1707 **** |
| 508 | return 0; |
| 509 | } |
| 510 | ! else if (ch < 'a' || ch > 'z') |
| 511 | { |
| 512 | rl_ding (); |
| 513 | --- 1745,1749 ---- |
| 514 | return 0; |
| 515 | } |
| 516 | ! else if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */ |
| 517 | { |
| 518 | rl_ding (); |
| 519 | |
| 520 | READLINE PATCH REPORT |
| 521 | ===================== |
| 522 | |
| 523 | Readline-Release: 5.2 |
| 524 | Patch-ID: readline52-006 |
| 525 | |
| 526 | Bug-Reported-by: Peter Volkov <torre_cremata@mail.ru> |
| 527 | Bug-Reference-ID: <1178376645.9063.25.camel@localhost> |
| 528 | Bug-Reference-URL: http://bugs.gentoo.org/177095 |
| 529 | |
| 530 | Bug-Description: |
| 531 | |
| 532 | The readline display code miscalculated the screen position when performing |
| 533 | a redisplay in which the new text occupies more screen space that the old, |
| 534 | but takes fewer bytes to do so (e.g., when replacing a shorter string |
| 535 | containing multibyte characters with a longer one containing only ASCII). |
| 536 | |
| 537 | Patch: |
| 538 | |
| 539 | *** ../readline-5.2/display.c Thu Apr 26 11:38:22 2007 |
| 540 | --- display.c Thu Jul 12 23:10:10 2007 |
| 541 | *************** |
| 542 | *** 1519,1527 **** |
| 543 | /* Non-zero if we're increasing the number of lines. */ |
| 544 | int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin; |
| 545 | /* Sometimes it is cheaper to print the characters rather than |
| 546 | use the terminal's capabilities. If we're growing the number |
| 547 | of lines, make sure we actually cause the new line to wrap |
| 548 | around on auto-wrapping terminals. */ |
| 549 | ! if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl)) |
| 550 | { |
| 551 | /* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and |
| 552 | --- 1568,1596 ---- |
| 553 | /* Non-zero if we're increasing the number of lines. */ |
| 554 | int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin; |
| 555 | + /* If col_lendiff is > 0, implying that the new string takes up more |
| 556 | + screen real estate than the old, but lendiff is < 0, meaning that it |
| 557 | + takes fewer bytes, we need to just output the characters starting |
| 558 | + from the first difference. These will overwrite what is on the |
| 559 | + display, so there's no reason to do a smart update. This can really |
| 560 | + only happen in a multibyte environment. */ |
| 561 | + if (lendiff < 0) |
| 562 | + { |
| 563 | + _rl_output_some_chars (nfd, temp); |
| 564 | + _rl_last_c_pos += _rl_col_width (nfd, 0, temp); |
| 565 | + /* If nfd begins before any invisible characters in the prompt, |
| 566 | + adjust _rl_last_c_pos to account for wrap_offset and set |
| 567 | + cpos_adjusted to let the caller know. */ |
| 568 | + if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) |
| 569 | + { |
| 570 | + _rl_last_c_pos -= wrap_offset; |
| 571 | + cpos_adjusted = 1; |
| 572 | + } |
| 573 | + return; |
| 574 | + } |
| 575 | /* Sometimes it is cheaper to print the characters rather than |
| 576 | use the terminal's capabilities. If we're growing the number |
| 577 | of lines, make sure we actually cause the new line to wrap |
| 578 | around on auto-wrapping terminals. */ |
| 579 | ! else if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl)) |
| 580 | { |
| 581 | /* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and |
| 582 | |
| 583 | READLINE PATCH REPORT |
| 584 | ===================== |
| 585 | |
| 586 | Readline-Release: 5.2 |
| 587 | Patch-ID: readline52-007 |
| 588 | |
| 589 | Bug-Reported-by: Tom Bjorkholm <tom.bjorkholm@ericsson.com> |
| 590 | Bug-Reference-ID: <AEA1A32F001C6B4F98614B5B80D7647D01C075E9@esealmw115.eemea.ericsson.se> |
| 591 | Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2007-04/msg00004.html |
| 592 | |
| 593 | |
| 594 | Bug-Description: |
| 595 | |
| 596 | An off-by-one error in readline's input buffering caused readline to drop |
| 597 | each 511th character of buffered input (e.g., when pasting a large amount |
| 598 | of data into a terminal window). |
| 599 | |
| 600 | Patch: |
| 601 | |
| 602 | *** ../readline-5.2/input.c Wed Aug 16 15:15:16 2006 |
| 603 | --- input.c Tue Jul 17 09:24:21 2007 |
| 604 | *************** |
| 605 | *** 134,139 **** |
| 606 | |
| 607 | *key = ibuffer[pop_index++]; |
| 608 | ! |
| 609 | if (pop_index >= ibuffer_len) |
| 610 | pop_index = 0; |
| 611 | |
| 612 | --- 134,142 ---- |
| 613 | |
| 614 | *key = ibuffer[pop_index++]; |
| 615 | ! #if 0 |
| 616 | if (pop_index >= ibuffer_len) |
| 617 | + #else |
| 618 | + if (pop_index > ibuffer_len) |
| 619 | + #endif |
| 620 | pop_index = 0; |
| 621 | |
| 622 | *************** |
| 623 | *** 251,255 **** |
| 624 | { |
| 625 | k = (*rl_getc_function) (rl_instream); |
| 626 | ! rl_stuff_char (k); |
| 627 | if (k == NEWLINE || k == RETURN) |
| 628 | break; |
| 629 | --- 254,259 ---- |
| 630 | { |
| 631 | k = (*rl_getc_function) (rl_instream); |
| 632 | ! if (rl_stuff_char (k) == 0) |
| 633 | ! break; /* some problem; no more room */ |
| 634 | if (k == NEWLINE || k == RETURN) |
| 635 | break; |
| 636 | *************** |
| 637 | *** 374,378 **** |
| 638 | --- 378,386 ---- |
| 639 | } |
| 640 | ibuffer[push_index++] = key; |
| 641 | + #if 0 |
| 642 | if (push_index >= ibuffer_len) |
| 643 | + #else |
| 644 | + if (push_index > ibuffer_len) |
| 645 | + #endif |
| 646 | push_index = 0; |
| 647 | |
| 648 | READLINE PATCH REPORT |
| 649 | ===================== |
| 650 | |
| 651 | Readline-Release: 5.2 |
| 652 | Patch-ID: readline52-008 |
| 653 | |
| 654 | Bug-Reported-by: dAniel hAhler <ubuntu@thequod.de> |
| 655 | Bug-Reference-ID: <4702ED8A.5000503@thequod.de> |
| 656 | Bug-Reference-URL: https://bugs.launchpad.net/ubuntu/+source/bash/+bug/119938 |
| 657 | |
| 658 | Bug-Description: |
| 659 | |
| 660 | When updating the display after displaying, for instance, a list of possible |
| 661 | completions, readline will place the cursor at the wrong position if the |
| 662 | prompt contains invisible characters and a newline. |
| 663 | |
| 664 | Patch: |
| 665 | |
| 666 | *** ../readline-5.2-patched/display.c Mon Aug 6 14:26:29 2007 |
| 667 | --- display.c Wed Oct 10 22:43:58 2007 |
| 668 | *************** |
| 669 | *** 1049,1053 **** |
| 670 | else |
| 671 | tx = nleft; |
| 672 | ! if (_rl_last_c_pos > tx) |
| 673 | { |
| 674 | _rl_backspace (_rl_last_c_pos - tx); /* XXX */ |
| 675 | --- 1049,1053 ---- |
| 676 | else |
| 677 | tx = nleft; |
| 678 | ! if (tx >= 0 && _rl_last_c_pos > tx) |
| 679 | { |
| 680 | _rl_backspace (_rl_last_c_pos - tx); /* XXX */ |
| 681 | *************** |
| 682 | *** 1205,1209 **** |
| 683 | { |
| 684 | register char *ofd, *ols, *oe, *nfd, *nls, *ne; |
| 685 | ! int temp, lendiff, wsatend, od, nd; |
| 686 | int current_invis_chars; |
| 687 | int col_lendiff, col_temp; |
| 688 | --- 1205,1209 ---- |
| 689 | { |
| 690 | register char *ofd, *ols, *oe, *nfd, *nls, *ne; |
| 691 | ! int temp, lendiff, wsatend, od, nd, o_cpos; |
| 692 | int current_invis_chars; |
| 693 | int col_lendiff, col_temp; |
| 694 | *************** |
| 695 | *** 1466,1469 **** |
| 696 | --- 1466,1471 ---- |
| 697 | } |
| 698 | |
| 699 | + o_cpos = _rl_last_c_pos; |
| 700 | + |
| 701 | /* When this function returns, _rl_last_c_pos is correct, and an absolute |
| 702 | cursor postion in multibyte mode, but a buffer index when not in a |
| 703 | *************** |
| 704 | *** 1475,1479 **** |
| 705 | invisible characters in the prompt string. Let's see if setting this when |
| 706 | we make sure we're at the end of the drawn prompt string works. */ |
| 707 | ! if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 && _rl_last_c_pos == prompt_physical_chars) |
| 708 | cpos_adjusted = 1; |
| 709 | #endif |
| 710 | --- 1477,1483 ---- |
| 711 | invisible characters in the prompt string. Let's see if setting this when |
| 712 | we make sure we're at the end of the drawn prompt string works. */ |
| 713 | ! if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 && |
| 714 | ! (_rl_last_c_pos > 0 || o_cpos > 0) && |
| 715 | ! _rl_last_c_pos == prompt_physical_chars) |
| 716 | cpos_adjusted = 1; |
| 717 | #endif |
| 718 | |
| 719 | READLINE PATCH REPORT |
| 720 | ===================== |
| 721 | |
| 722 | Readline-Release: 5.2 |
| 723 | Patch-ID: readline52-009 |
| 724 | |
| 725 | Bug-Reported-by: dAniel hAhler <ubuntu@thequod.de> |
| 726 | Bug-Reference-ID: |
| 727 | Bug-Reference-URL: |
| 728 | |
| 729 | Bug-Description: |
| 730 | |
| 731 | Under some circumstances, readline will incorrectly display a prompt string |
| 732 | containing invisible characters after the final newline. |
| 733 | |
| 734 | Patch: |
| 735 | |
| 736 | *** ../readline-5.2-patched/display.c 2007-08-25 13:47:08.000000000 -0400 |
| 737 | --- display.c 2007-11-10 17:51:29.000000000 -0500 |
| 738 | *************** |
| 739 | *** 392,396 **** |
| 740 | local_prompt = expand_prompt (p, &prompt_visible_length, |
| 741 | &prompt_last_invisible, |
| 742 | ! (int *)NULL, |
| 743 | &prompt_physical_chars); |
| 744 | c = *t; *t = '\0'; |
| 745 | --- 420,424 ---- |
| 746 | local_prompt = expand_prompt (p, &prompt_visible_length, |
| 747 | &prompt_last_invisible, |
| 748 | ! &prompt_invis_chars_first_line, |
| 749 | &prompt_physical_chars); |
| 750 | c = *t; *t = '\0'; |
| 751 | *************** |
| 752 | *** 399,403 **** |
| 753 | local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length, |
| 754 | (int *)NULL, |
| 755 | ! &prompt_invis_chars_first_line, |
| 756 | (int *)NULL); |
| 757 | *t = c; |
| 758 | --- 427,431 ---- |
| 759 | local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length, |
| 760 | (int *)NULL, |
| 761 | ! (int *)NULL, |
| 762 | (int *)NULL); |
| 763 | *t = c; |
| 764 | |
| 765 | READLINE PATCH REPORT |
| 766 | ===================== |
| 767 | |
| 768 | Readline-Release: 5.2 |
| 769 | Patch-ID: readline52-010 |
| 770 | |
| 771 | Bug-Reported-by: Miroslav Lichvar <mlichvar@redhat.com> |
| 772 | Bug-Reference-ID: Fri, 02 Nov 2007 14:07:45 +0100 |
| 773 | Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2007-11/msg00000.html |
| 774 | |
| 775 | Bug-Description: |
| 776 | |
| 777 | In certain cases when outputting characters at the end of the line, |
| 778 | e.g., when displaying the prompt string, readline positions the cursor |
| 779 | incorrectly if the prompt string contains invisible characters and the |
| 780 | text being drawn begins before the last invisible character in the line. |
| 781 | |
| 782 | Patch: |
| 783 | |
| 784 | *** ../readline-5.2-patched/display.c 2007-08-25 13:47:08.000000000 -0400 |
| 785 | --- display.c 2007-11-10 17:51:29.000000000 -0500 |
| 786 | *************** |
| 787 | *** 1566,1574 **** |
| 788 | else |
| 789 | { |
| 790 | - /* We have horizontal scrolling and we are not inserting at |
| 791 | - the end. We have invisible characters in this line. This |
| 792 | - is a dumb update. */ |
| 793 | _rl_output_some_chars (nfd, temp); |
| 794 | _rl_last_c_pos += col_temp; |
| 795 | return; |
| 796 | } |
| 797 | --- 1619,1632 ---- |
| 798 | else |
| 799 | { |
| 800 | _rl_output_some_chars (nfd, temp); |
| 801 | _rl_last_c_pos += col_temp; |
| 802 | + /* If nfd begins before any invisible characters in the prompt, |
| 803 | + adjust _rl_last_c_pos to account for wrap_offset and set |
| 804 | + cpos_adjusted to let the caller know. */ |
| 805 | + if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) |
| 806 | + { |
| 807 | + _rl_last_c_pos -= wrap_offset; |
| 808 | + cpos_adjusted = 1; |
| 809 | + } |
| 810 | return; |
| 811 | } |
| 812 | |
| 813 | READLINE PATCH REPORT |
| 814 | ===================== |
| 815 | |
| 816 | Readline-Release: 5.2 |
| 817 | Patch-ID: readline52-011 |
| 818 | |
| 819 | Bug-Reported-by: Uwe Doering <gemini@geminix.org> |
| 820 | Bug-Reference-ID: <46F3DD72.2090801@geminix.org> |
| 821 | Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2007-09/msg00102.html |
| 822 | |
| 823 | Bug-Description: |
| 824 | |
| 825 | There is an off-by-one error in the code that buffers characters received |
| 826 | very quickly in succession, causing characters to be dropped. |
| 827 | |
| 828 | Patch: |
| 829 | |
| 830 | *** ../readline-5.2-patched/input.c 2007-08-25 13:47:10.000000000 -0400 |
| 831 | --- input.c 2007-10-12 22:55:25.000000000 -0400 |
| 832 | *************** |
| 833 | *** 155,159 **** |
| 834 | pop_index--; |
| 835 | if (pop_index < 0) |
| 836 | ! pop_index = ibuffer_len - 1; |
| 837 | ibuffer[pop_index] = key; |
| 838 | return (1); |
| 839 | --- 155,159 ---- |
| 840 | pop_index--; |
| 841 | if (pop_index < 0) |
| 842 | ! pop_index = ibuffer_len; |
| 843 | ibuffer[pop_index] = key; |
| 844 | return (1); |
| 845 | |
| 846 | READLINE PATCH REPORT |
| 847 | ===================== |
| 848 | |
| 849 | Readline-Release: 5.2 |
| 850 | Patch-ID: readline52-012 |
| 851 | |
| 852 | Bug-Reported-by: Chet Ramey <chet.ramey@case.edu> |
| 853 | Bug-Reference-ID: |
| 854 | Bug-Reference-URL: |
| 855 | |
| 856 | Bug-Description: |
| 857 | |
| 858 | This updates the options required to create shared libraries on several |
| 859 | systems, including Mac OS X 10.5 (darwin9.x), FreeBSD, NetBSD, OpenBSD, |
| 860 | AIX, and HP/UX. |
| 861 | |
| 862 | Patch: |
| 863 | |
| 864 | *** ../readline-5.2-patched/support/shobj-conf 2006-04-11 09:15:43.000000000 -0400 |
| 865 | --- support/shobj-conf 2007-12-06 23:46:41.000000000 -0500 |
| 866 | *************** |
| 867 | *** 11,15 **** |
| 868 | # chet@po.cwru.edu |
| 869 | |
| 870 | ! # Copyright (C) 1996-2002 Free Software Foundation, Inc. |
| 871 | # |
| 872 | # This program is free software; you can redistribute it and/or modify |
| 873 | --- 11,15 ---- |
| 874 | # chet@po.cwru.edu |
| 875 | |
| 876 | ! # Copyright (C) 1996-2007 Free Software Foundation, Inc. |
| 877 | # |
| 878 | # This program is free software; you can redistribute it and/or modify |
| 879 | *************** |
| 880 | *** 115,119 **** |
| 881 | ;; |
| 882 | |
| 883 | ! freebsd2* | netbsd*) |
| 884 | SHOBJ_CFLAGS=-fpic |
| 885 | SHOBJ_LD=ld |
| 886 | --- 115,119 ---- |
| 887 | ;; |
| 888 | |
| 889 | ! freebsd2*) |
| 890 | SHOBJ_CFLAGS=-fpic |
| 891 | SHOBJ_LD=ld |
| 892 | *************** |
| 893 | *** 126,130 **** |
| 894 | # FreeBSD-3.x ELF |
| 895 | freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*) |
| 896 | ! SHOBJ_CFLAGS=-fpic |
| 897 | SHOBJ_LD='${CC}' |
| 898 | |
| 899 | --- 126,130 ---- |
| 900 | # FreeBSD-3.x ELF |
| 901 | freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*) |
| 902 | ! SHOBJ_CFLAGS=-fPIC |
| 903 | SHOBJ_LD='${CC}' |
| 904 | |
| 905 | *************** |
| 906 | *** 143,147 **** |
| 907 | |
| 908 | # Darwin/MacOS X |
| 909 | ! darwin8*) |
| 910 | SHOBJ_STATUS=supported |
| 911 | SHLIB_STATUS=supported |
| 912 | --- 143,147 ---- |
| 913 | |
| 914 | # Darwin/MacOS X |
| 915 | ! darwin[89]*) |
| 916 | SHOBJ_STATUS=supported |
| 917 | SHLIB_STATUS=supported |
| 918 | *************** |
| 919 | *** 154,158 **** |
| 920 | SHLIB_LIBSUFF='dylib' |
| 921 | |
| 922 | ! SHOBJ_LDFLAGS='-undefined dynamic_lookup' |
| 923 | SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v' |
| 924 | |
| 925 | --- 154,158 ---- |
| 926 | SHLIB_LIBSUFF='dylib' |
| 927 | |
| 928 | ! SHOBJ_LDFLAGS='-dynamiclib -dynamic -undefined dynamic_lookup -arch_only `/usr/bin/arch`' |
| 929 | SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v' |
| 930 | |
| 931 | *************** |
| 932 | *** 172,176 **** |
| 933 | |
| 934 | case "${host_os}" in |
| 935 | ! darwin[78]*) SHOBJ_LDFLAGS='' |
| 936 | SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v' |
| 937 | ;; |
| 938 | --- 172,176 ---- |
| 939 | |
| 940 | case "${host_os}" in |
| 941 | ! darwin[789]*) SHOBJ_LDFLAGS='' |
| 942 | SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v' |
| 943 | ;; |
| 944 | *************** |
| 945 | *** 183,187 **** |
| 946 | ;; |
| 947 | |
| 948 | ! openbsd*) |
| 949 | SHOBJ_CFLAGS=-fPIC |
| 950 | SHOBJ_LD='${CC}' |
| 951 | --- 183,187 ---- |
| 952 | ;; |
| 953 | |
| 954 | ! openbsd*|netbsd*) |
| 955 | SHOBJ_CFLAGS=-fPIC |
| 956 | SHOBJ_LD='${CC}' |
| 957 | *************** |
| 958 | *** 248,252 **** |
| 959 | ;; |
| 960 | |
| 961 | ! aix4.[2-9]*-*gcc*) # lightly tested by jik@cisco.com |
| 962 | SHOBJ_CFLAGS=-fpic |
| 963 | SHOBJ_LD='ld' |
| 964 | --- 248,252 ---- |
| 965 | ;; |
| 966 | |
| 967 | ! aix4.[2-9]*-*gcc*|aix[5-9].*-*gcc*) # lightly tested by jik@cisco.com |
| 968 | SHOBJ_CFLAGS=-fpic |
| 969 | SHOBJ_LD='ld' |
| 970 | *************** |
| 971 | *** 259,263 **** |
| 972 | ;; |
| 973 | |
| 974 | ! aix4.[2-9]*) |
| 975 | SHOBJ_CFLAGS=-K |
| 976 | SHOBJ_LD='ld' |
| 977 | --- 259,263 ---- |
| 978 | ;; |
| 979 | |
| 980 | ! aix4.[2-9]*|aix[5-9].*) |
| 981 | SHOBJ_CFLAGS=-K |
| 982 | SHOBJ_LD='ld' |
| 983 | *************** |
| 984 | *** 330,334 **** |
| 985 | # if you have problems linking here, moving the `-Wl,+h,$@' from |
| 986 | # SHLIB_XLDFLAGS to SHOBJ_LDFLAGS has been reported to work |
| 987 | ! SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s' |
| 988 | |
| 989 | SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)' |
| 990 | --- 330,334 ---- |
| 991 | # if you have problems linking here, moving the `-Wl,+h,$@' from |
| 992 | # SHLIB_XLDFLAGS to SHOBJ_LDFLAGS has been reported to work |
| 993 | ! SHOBJ_LDFLAGS='-shared -fpic -Wl,-b -Wl,+s' |
| 994 | |
| 995 | SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)' |
| 996 | |
| 997 | READLINE PATCH REPORT |
| 998 | ===================== |
| 999 | |
| 1000 | Readline-Release: 5.2 |
| 1001 | Patch-ID: readline52-013 |
| 1002 | |
| 1003 | Bug-Reported-by: slinkp <stuff@slinkp.com> |
| 1004 | Bug-Reference-ID: <da52a26a-9f38-4861-a918-14d3482b539d@c65g2000hsa.googlegroups.com> |
| 1005 | Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2008-05/msg00085.html |
| 1006 | |
| 1007 | Bug-Description: |
| 1008 | |
| 1009 | The presence of invisible characters in a prompt longer than the screenwidth |
| 1010 | with invisible characters on the first and last prompt lines caused readline |
| 1011 | to place the cursor in the wrong physical location. |
| 1012 | |
| 1013 | Patch: |
| 1014 | |
| 1015 | *** ../readline-5.2-patched/display.c 2007-12-14 21:12:40.000000000 -0500 |
| 1016 | --- display.c 2008-10-23 09:39:46.000000000 -0400 |
| 1017 | *************** |
| 1018 | *** 911,914 **** |
| 1019 | --- 944,951 ---- |
| 1020 | OFFSET (which has already been calculated above). */ |
| 1021 | |
| 1022 | + #define INVIS_FIRST() (prompt_physical_chars > _rl_screenwidth ? prompt_invis_chars_first_line : wrap_offset) |
| 1023 | + #define WRAP_OFFSET(line, offset) ((line == 0) \ |
| 1024 | + ? (offset ? INVIS_FIRST() : 0) \ |
| 1025 | + : ((line == prompt_last_screen_line) ? wrap_offset-prompt_invis_chars_first_line : 0)) |
| 1026 | #define W_OFFSET(line, offset) ((line) == 0 ? offset : 0) |
| 1027 | #define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l])) |
| 1028 | *************** |
| 1029 | *** 945,949 **** |
| 1030 | _rl_last_c_pos > wrap_offset && |
| 1031 | o_cpos < prompt_last_invisible) |
| 1032 | ! _rl_last_c_pos -= wrap_offset; |
| 1033 | |
| 1034 | /* If this is the line with the prompt, we might need to |
| 1035 | --- 982,992 ---- |
| 1036 | _rl_last_c_pos > wrap_offset && |
| 1037 | o_cpos < prompt_last_invisible) |
| 1038 | ! _rl_last_c_pos -= prompt_invis_chars_first_line; /* XXX - was wrap_offset */ |
| 1039 | ! else if (linenum == prompt_last_screen_line && prompt_physical_chars > _rl_screenwidth && |
| 1040 | ! (MB_CUR_MAX > 1 && rl_byte_oriented == 0) && |
| 1041 | ! cpos_adjusted == 0 && |
| 1042 | ! _rl_last_c_pos != o_cpos && |
| 1043 | ! _rl_last_c_pos > (prompt_last_invisible - _rl_screenwidth - prompt_invis_chars_first_line)) |
| 1044 | ! _rl_last_c_pos -= (wrap_offset-prompt_invis_chars_first_line); |
| 1045 | |
| 1046 | /* If this is the line with the prompt, we might need to |
| 1047 | *************** |
| 1048 | *** 1205,1209 **** |
| 1049 | { |
| 1050 | register char *ofd, *ols, *oe, *nfd, *nls, *ne; |
| 1051 | ! int temp, lendiff, wsatend, od, nd, o_cpos; |
| 1052 | int current_invis_chars; |
| 1053 | int col_lendiff, col_temp; |
| 1054 | --- 1264,1268 ---- |
| 1055 | { |
| 1056 | register char *ofd, *ols, *oe, *nfd, *nls, *ne; |
| 1057 | ! int temp, lendiff, wsatend, od, nd, twidth, o_cpos; |
| 1058 | int current_invis_chars; |
| 1059 | int col_lendiff, col_temp; |
| 1060 | *************** |
| 1061 | *** 1221,1225 **** |
| 1062 | temp = _rl_last_c_pos; |
| 1063 | else |
| 1064 | ! temp = _rl_last_c_pos - W_OFFSET(_rl_last_v_pos, visible_wrap_offset); |
| 1065 | if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode |
| 1066 | && _rl_last_v_pos == current_line - 1) |
| 1067 | --- 1280,1284 ---- |
| 1068 | temp = _rl_last_c_pos; |
| 1069 | else |
| 1070 | ! temp = _rl_last_c_pos - WRAP_OFFSET (_rl_last_v_pos, visible_wrap_offset); |
| 1071 | if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode |
| 1072 | && _rl_last_v_pos == current_line - 1) |
| 1073 | *************** |
| 1074 | *** 1587,1599 **** |
| 1075 | { |
| 1076 | _rl_output_some_chars (nfd + lendiff, temp - lendiff); |
| 1077 | - #if 1 |
| 1078 | /* XXX -- this bears closer inspection. Fixes a redisplay bug |
| 1079 | reported against bash-3.0-alpha by Andreas Schwab involving |
| 1080 | multibyte characters and prompt strings with invisible |
| 1081 | characters, but was previously disabled. */ |
| 1082 | ! _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-col_lendiff); |
| 1083 | ! #else |
| 1084 | ! _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff); |
| 1085 | ! #endif |
| 1086 | } |
| 1087 | } |
| 1088 | --- 1648,1660 ---- |
| 1089 | { |
| 1090 | _rl_output_some_chars (nfd + lendiff, temp - lendiff); |
| 1091 | /* XXX -- this bears closer inspection. Fixes a redisplay bug |
| 1092 | reported against bash-3.0-alpha by Andreas Schwab involving |
| 1093 | multibyte characters and prompt strings with invisible |
| 1094 | characters, but was previously disabled. */ |
| 1095 | ! if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) |
| 1096 | ! twidth = _rl_col_width (nfd+lendiff, 0, temp-col_lendiff); |
| 1097 | ! else |
| 1098 | ! twidth = temp - lendiff; |
| 1099 | ! _rl_last_c_pos += twidth; |
| 1100 | } |
| 1101 | } |
| 1102 | *************** |
| 1103 | *** 1789,1793 **** |
| 1104 | int cpos, dpos; /* current and desired cursor positions */ |
| 1105 | |
| 1106 | ! woff = W_OFFSET (_rl_last_v_pos, wrap_offset); |
| 1107 | cpos = _rl_last_c_pos; |
| 1108 | #if defined (HANDLE_MULTIBYTE) |
| 1109 | --- 1850,1854 ---- |
| 1110 | int cpos, dpos; /* current and desired cursor positions */ |
| 1111 | |
| 1112 | ! woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset); |
| 1113 | cpos = _rl_last_c_pos; |
| 1114 | #if defined (HANDLE_MULTIBYTE) |
| 1115 | *************** |
| 1116 | *** 1803,1807 **** |
| 1117 | prompt string, since they're both buffer indices and DPOS is a |
| 1118 | desired display position. */ |
| 1119 | ! if (new > prompt_last_invisible) /* XXX - don't use woff here */ |
| 1120 | { |
| 1121 | dpos -= woff; |
| 1122 | --- 1864,1872 ---- |
| 1123 | prompt string, since they're both buffer indices and DPOS is a |
| 1124 | desired display position. */ |
| 1125 | ! if ((new > prompt_last_invisible) || /* XXX - don't use woff here */ |
| 1126 | ! (prompt_physical_chars > _rl_screenwidth && |
| 1127 | ! _rl_last_v_pos == prompt_last_screen_line && |
| 1128 | ! wrap_offset != woff && |
| 1129 | ! new > (prompt_last_invisible-_rl_screenwidth-wrap_offset))) |
| 1130 | { |
| 1131 | dpos -= woff; |