readline52-008.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. READLINE PATCH REPORT
  2. =====================
  3. Readline-Release: 5.2
  4. Patch-ID: readline52-008
  5. Bug-Reported-by: dAniel hAhler <ubuntu@thequod.de>
  6. Bug-Reference-ID: <4702ED8A.5000503@thequod.de>
  7. Bug-Reference-URL: https://bugs.launchpad.net/ubuntu/+source/bash/+bug/119938
  8. Bug-Description:
  9. When updating the display after displaying, for instance, a list of possible
  10. completions, readline will place the cursor at the wrong position if the
  11. prompt contains invisible characters and a newline.
  12. Patch:
  13. *** ../readline-5.2-patched/display.c Mon Aug 6 14:26:29 2007
  14. --- ./display.c Wed Oct 10 22:43:58 2007
  15. ***************
  16. *** 1049,1053 ****
  17. else
  18. tx = nleft;
  19. ! if (_rl_last_c_pos > tx)
  20. {
  21. _rl_backspace (_rl_last_c_pos - tx); /* XXX */
  22. --- 1049,1053 ----
  23. else
  24. tx = nleft;
  25. ! if (tx >= 0 && _rl_last_c_pos > tx)
  26. {
  27. _rl_backspace (_rl_last_c_pos - tx); /* XXX */
  28. ***************
  29. *** 1205,1209 ****
  30. {
  31. register char *ofd, *ols, *oe, *nfd, *nls, *ne;
  32. ! int temp, lendiff, wsatend, od, nd;
  33. int current_invis_chars;
  34. int col_lendiff, col_temp;
  35. --- 1205,1209 ----
  36. {
  37. register char *ofd, *ols, *oe, *nfd, *nls, *ne;
  38. ! int temp, lendiff, wsatend, od, nd, o_cpos;
  39. int current_invis_chars;
  40. int col_lendiff, col_temp;
  41. ***************
  42. *** 1466,1469 ****
  43. --- 1466,1471 ----
  44. }
  45. + o_cpos = _rl_last_c_pos;
  46. +
  47. /* When this function returns, _rl_last_c_pos is correct, and an absolute
  48. cursor postion in multibyte mode, but a buffer index when not in a
  49. ***************
  50. *** 1475,1479 ****
  51. invisible characters in the prompt string. Let's see if setting this when
  52. we make sure we're at the end of the drawn prompt string works. */
  53. ! if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 && _rl_last_c_pos == prompt_physical_chars)
  54. cpos_adjusted = 1;
  55. #endif
  56. --- 1477,1483 ----
  57. invisible characters in the prompt string. Let's see if setting this when
  58. we make sure we're at the end of the drawn prompt string works. */
  59. ! if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 &&
  60. ! (_rl_last_c_pos > 0 || o_cpos > 0) &&
  61. ! _rl_last_c_pos == prompt_physical_chars)
  62. cpos_adjusted = 1;
  63. #endif