readline52-004.patch 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. READLINE PATCH REPORT
  2. =====================
  3. Readline-Release: 5.2
  4. Patch-ID: readline52-004
  5. Bug-Reported-by: Peter Volkov <torre_cremata@mail.ru>
  6. Bug-Reference-ID: <1173636022.7039.36.camel@localhost>
  7. Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2007-03/msg00039.html
  8. Bug-Description:
  9. When restoring the original prompt after finishing an incremental search,
  10. bash sometimes places the cursor incorrectly if the primary prompt contains
  11. invisible characters.
  12. Patch:
  13. *** ../readline-5.2.3/display.c Fri Apr 20 13:30:16 2007
  14. --- ./display.c Fri Apr 20 15:17:01 2007
  15. ***************
  16. *** 1599,1604 ****
  17. if (temp > 0)
  18. {
  19. _rl_output_some_chars (nfd, temp);
  20. ! _rl_last_c_pos += _rl_col_width (nfd, 0, temp);;
  21. }
  22. }
  23. --- 1599,1618 ----
  24. if (temp > 0)
  25. {
  26. + /* If nfd begins at the prompt, or before the invisible
  27. + characters in the prompt, we need to adjust _rl_last_c_pos
  28. + in a multibyte locale to account for the wrap offset and
  29. + set cpos_adjusted accordingly. */
  30. _rl_output_some_chars (nfd, temp);
  31. ! if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
  32. ! {
  33. ! _rl_last_c_pos += _rl_col_width (nfd, 0, temp);
  34. ! if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
  35. ! {
  36. ! _rl_last_c_pos -= wrap_offset;
  37. ! cpos_adjusted = 1;
  38. ! }
  39. ! }
  40. ! else
  41. ! _rl_last_c_pos += temp;
  42. }
  43. }
  44. ***************
  45. *** 1608,1613 ****
  46. --- 1622,1639 ----
  47. if (temp > 0)
  48. {
  49. + /* If nfd begins at the prompt, or before the invisible
  50. + characters in the prompt, we need to adjust _rl_last_c_pos
  51. + in a multibyte locale to account for the wrap offset and
  52. + set cpos_adjusted accordingly. */
  53. _rl_output_some_chars (nfd, temp);
  54. _rl_last_c_pos += col_temp; /* XXX */
  55. + if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
  56. + {
  57. + if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
  58. + {
  59. + _rl_last_c_pos -= wrap_offset;
  60. + cpos_adjusted = 1;
  61. + }
  62. + }
  63. }
  64. lendiff = (oe - old) - (ne - new);