bash32-024 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. BASH PATCH REPORT
  2. =================
  3. Bash-Release: 3.2
  4. Patch-ID: bash32-024
  5. Bug-Reported-by: Peter Volkov <torre_cremata@mail.ru>
  6. Bug-Reference-ID: <1178376645.9063.25.camel@localhost>
  7. Bug-Reference-URL: http://bugs.gentoo.org/177095
  8. Bug-Description:
  9. The readline display code miscalculated the screen position when performing
  10. a redisplay in which the new text occupies more screen space that the old,
  11. but takes fewer bytes to do so (e.g., when replacing a shorter string
  12. containing multibyte characters with a longer one containing only ASCII).
  13. Patch:
  14. *** ../bash-3.2-patched/lib/readline/display.c Thu Apr 26 11:38:22 2007
  15. --- bash-3.2/lib/readline/display.c Thu Jul 12 23:10:10 2007
  16. ***************
  17. *** 1519,1527 ****
  18. /* Non-zero if we're increasing the number of lines. */
  19. int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin;
  20. /* Sometimes it is cheaper to print the characters rather than
  21. use the terminal's capabilities. If we're growing the number
  22. of lines, make sure we actually cause the new line to wrap
  23. around on auto-wrapping terminals. */
  24. ! if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl))
  25. {
  26. /* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and
  27. --- 1568,1596 ----
  28. /* Non-zero if we're increasing the number of lines. */
  29. int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin;
  30. + /* If col_lendiff is > 0, implying that the new string takes up more
  31. + screen real estate than the old, but lendiff is < 0, meaning that it
  32. + takes fewer bytes, we need to just output the characters starting
  33. + from the first difference. These will overwrite what is on the
  34. + display, so there's no reason to do a smart update. This can really
  35. + only happen in a multibyte environment. */
  36. + if (lendiff < 0)
  37. + {
  38. + _rl_output_some_chars (nfd, temp);
  39. + _rl_last_c_pos += _rl_col_width (nfd, 0, temp);
  40. + /* If nfd begins before any invisible characters in the prompt,
  41. + adjust _rl_last_c_pos to account for wrap_offset and set
  42. + cpos_adjusted to let the caller know. */
  43. + if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
  44. + {
  45. + _rl_last_c_pos -= wrap_offset;
  46. + cpos_adjusted = 1;
  47. + }
  48. + return;
  49. + }
  50. /* Sometimes it is cheaper to print the characters rather than
  51. use the terminal's capabilities. If we're growing the number
  52. of lines, make sure we actually cause the new line to wrap
  53. around on auto-wrapping terminals. */
  54. ! else if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl))
  55. {
  56. /* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and
  57. *** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006
  58. --- bash-3.2/patchlevel.h Mon Oct 16 14:22:54 2006
  59. ***************
  60. *** 26,30 ****
  61. looks for to find the patch level (for the sccs version string). */
  62. ! #define PATCHLEVEL 23
  63. #endif /* _PATCHLEVEL_H_ */
  64. --- 26,30 ----
  65. looks for to find the patch level (for the sccs version string). */
  66. ! #define PATCHLEVEL 24
  67. #endif /* _PATCHLEVEL_H_ */