mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
3.4 KiB

  1. Copied from www.linuxfromscratch.org to ROCK Linux.
  2. Submitted By: Joe Ciccone <jciccone@gmail.com>
  3. Date: 2007-07-23
  4. Initial Package Version: 5.2
  5. Origin: ftp://ftp.cwru.edu/pub/bash/readline-5.2-patches
  6. Upstream Status: From Upstream
  7. Description: Contains patches 001 - 004 from upstream
  8. diff -Naur readline-5.2.orig/display.c readline-5.2/display.c
  9. --- readline-5.2.orig/display.c 2007-07-23 20:10:10.000000000 -0400
  10. +++ readline-5.2/display.c 2007-07-23 20:10:27.000000000 -0400
  11. @@ -561,6 +561,17 @@
  12. wrap_offset = prompt_invis_chars_first_line = 0;
  13. }
  14. +#if defined (HANDLE_MULTIBYTE)
  15. +#define CHECK_INV_LBREAKS() \
  16. + do { \
  17. + if (newlines >= (inv_lbsize - 2)) \
  18. + { \
  19. + inv_lbsize *= 2; \
  20. + inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
  21. + _rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \
  22. + } \
  23. + } while (0)
  24. +#else
  25. #define CHECK_INV_LBREAKS() \
  26. do { \
  27. if (newlines >= (inv_lbsize - 2)) \
  28. @@ -569,6 +580,7 @@
  29. inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
  30. } \
  31. } while (0)
  32. +#endif /* HANDLE_MULTIBYTE */
  33. #if defined (HANDLE_MULTIBYTE)
  34. #define CHECK_LPOS() \
  35. @@ -1586,8 +1598,22 @@
  36. temp = nls - nfd;
  37. if (temp > 0)
  38. {
  39. + /* If nfd begins at the prompt, or before the invisible
  40. + characters in the prompt, we need to adjust _rl_last_c_pos
  41. + in a multibyte locale to account for the wrap offset and
  42. + set cpos_adjusted accordingly. */
  43. _rl_output_some_chars (nfd, temp);
  44. - _rl_last_c_pos += _rl_col_width (nfd, 0, temp);;
  45. + if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
  46. + {
  47. + _rl_last_c_pos += _rl_col_width (nfd, 0, temp);
  48. + if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
  49. + {
  50. + _rl_last_c_pos -= wrap_offset;
  51. + cpos_adjusted = 1;
  52. + }
  53. + }
  54. + else
  55. + _rl_last_c_pos += temp;
  56. }
  57. }
  58. /* Otherwise, print over the existing material. */
  59. @@ -1595,8 +1621,20 @@
  60. {
  61. if (temp > 0)
  62. {
  63. + /* If nfd begins at the prompt, or before the invisible
  64. + characters in the prompt, we need to adjust _rl_last_c_pos
  65. + in a multibyte locale to account for the wrap offset and
  66. + set cpos_adjusted accordingly. */
  67. _rl_output_some_chars (nfd, temp);
  68. _rl_last_c_pos += col_temp; /* XXX */
  69. + if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
  70. + {
  71. + if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
  72. + {
  73. + _rl_last_c_pos -= wrap_offset;
  74. + cpos_adjusted = 1;
  75. + }
  76. + }
  77. }
  78. lendiff = (oe - old) - (ne - new);
  79. if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
  80. @@ -1732,7 +1770,10 @@
  81. if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
  82. {
  83. dpos = _rl_col_width (data, 0, new);
  84. - if (dpos > prompt_last_invisible) /* XXX - don't use woff here */
  85. + /* Use NEW when comparing against the last invisible character in the
  86. + prompt string, since they're both buffer indices and DPOS is a
  87. + desired display position. */
  88. + if (new > prompt_last_invisible) /* XXX - don't use woff here */
  89. {
  90. dpos -= woff;
  91. /* Since this will be assigned to _rl_last_c_pos at the end (more
  92. @@ -2380,6 +2421,8 @@
  93. if (end <= start)
  94. return 0;
  95. + if (MB_CUR_MAX == 1 || rl_byte_oriented)
  96. + return (end - start);
  97. memset (&ps, 0, sizeof (mbstate_t));