bash30-006 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. BASH PATCH REPORT
  2. =================
  3. Bash-Release: 3.0
  4. Patch-ID: bash30-006
  5. Bug-Reported-by: alexander@skwar.name
  6. Tomohiro KUBOTA <debian@tmail.plala.or.jp>
  7. Bug-Reference-ID: <20040801124721.C69B8A2547A@server.bei.digitalprojects.com>
  8. <16688.41450.433668.480445@gargle.gargle.HOWL>
  9. Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2004-08/msg00006.html
  10. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=257540
  11. Bug-Description:
  12. Prompts with multibyte characters or invisible characters following a line
  13. wrap are displayed incorrectly.
  14. Patch:
  15. *** ../bash-3.0/lib/readline/display.c Thu May 27 22:57:51 2004
  16. --- lib/readline/display.c Mon Aug 30 11:55:02 2004
  17. ***************
  18. *** 202,206 ****
  19. {
  20. char *r, *ret, *p;
  21. ! int l, rl, last, ignoring, ninvis, invfl, ind, pind, physchars;
  22. /* Short-circuit if we can. */
  23. --- 202,206 ----
  24. {
  25. char *r, *ret, *p;
  26. ! int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars;
  27. /* Short-circuit if we can. */
  28. ***************
  29. *** 223,226 ****
  30. --- 223,227 ----
  31. invfl = 0; /* invisible chars in first line of prompt */
  32. + invflset = 0; /* we only want to set invfl once */
  33. for (rl = ignoring = last = ninvis = physchars = 0, p = pmt; p && *p; p++)
  34. ***************
  35. *** 250,254 ****
  36. *r++ = *p++;
  37. if (!ignoring)
  38. ! rl += ind - pind;
  39. else
  40. ninvis += ind - pind;
  41. --- 251,258 ----
  42. *r++ = *p++;
  43. if (!ignoring)
  44. ! {
  45. ! rl += ind - pind;
  46. ! physchars += _rl_col_width (pmt, pind, ind);
  47. ! }
  48. else
  49. ninvis += ind - pind;
  50. ***************
  51. *** 260,273 ****
  52. *r++ = *p;
  53. if (!ignoring)
  54. ! rl++; /* visible length byte counter */
  55. else
  56. ninvis++; /* invisible chars byte counter */
  57. }
  58. ! if (rl >= _rl_screenwidth)
  59. ! invfl = ninvis;
  60. !
  61. ! if (ignoring == 0)
  62. ! physchars++;
  63. }
  64. }
  65. --- 264,280 ----
  66. *r++ = *p;
  67. if (!ignoring)
  68. ! {
  69. ! rl++; /* visible length byte counter */
  70. ! physchars++;
  71. ! }
  72. else
  73. ninvis++; /* invisible chars byte counter */
  74. }
  75. ! if (invflset == 0 && rl >= _rl_screenwidth)
  76. ! {
  77. ! invfl = ninvis;
  78. ! invflset = 1;
  79. ! }
  80. }
  81. }
  82. ***************
  83. *** 418,422 ****
  84. register char *line;
  85. int c_pos, inv_botlin, lb_botlin, lb_linenum;
  86. ! int newlines, lpos, temp, modmark;
  87. char *prompt_this_line;
  88. #if defined (HANDLE_MULTIBYTE)
  89. --- 425,429 ----
  90. register char *line;
  91. int c_pos, inv_botlin, lb_botlin, lb_linenum;
  92. ! int newlines, lpos, temp, modmark, n0, num;
  93. char *prompt_this_line;
  94. #if defined (HANDLE_MULTIBYTE)
  95. ***************
  96. *** 574,577 ****
  97. --- 581,585 ----
  98. #if defined (HANDLE_MULTIBYTE)
  99. memset (_rl_wrapped_line, 0, vis_lbsize);
  100. + num = 0;
  101. #endif
  102. ***************
  103. *** 592,596 ****
  104. --- 600,619 ----
  105. prompts that exceed two physical lines?
  106. Additional logic fix from Edward Catmur <ed@catmur.co.uk> */
  107. + #if defined (HANDLE_MULTIBYTE)
  108. + n0 = num;
  109. + temp = local_prompt ? strlen (local_prompt) : 0;
  110. + while (num < temp)
  111. + {
  112. + if (_rl_col_width (local_prompt, n0, num) > _rl_screenwidth)
  113. + {
  114. + num = _rl_find_prev_mbchar (local_prompt, num, MB_FIND_ANY);
  115. + break;
  116. + }
  117. + num++;
  118. + }
  119. + temp = num +
  120. + #else
  121. temp = ((newlines + 1) * _rl_screenwidth) +
  122. + #endif /* !HANDLE_MULTIBYTE */
  123. ((local_prompt_prefix == 0) ? ((newlines == 0) ? prompt_invis_chars_first_line
  124. : ((newlines == 1) ? wrap_offset : 0))
  125. ***************
  126. *** 598,602 ****
  127. --- 621,629 ----
  128. inv_lbreaks[++newlines] = temp;
  129. + #if defined (HANDLE_MULTIBYTE)
  130. + lpos -= _rl_col_width (local_prompt, n0, num);
  131. + #else
  132. lpos -= _rl_screenwidth;
  133. + #endif
  134. }
  135. *** ../bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
  136. --- patchlevel.h Thu Sep 2 15:04:32 2004
  137. ***************
  138. *** 26,30 ****
  139. looks for to find the patch level (for the sccs version string). */
  140. ! #define PATCHLEVEL 5
  141. #endif /* _PATCHLEVEL_H_ */
  142. --- 26,30 ----
  143. looks for to find the patch level (for the sccs version string). */
  144. ! #define PATCHLEVEL 6
  145. #endif /* _PATCHLEVEL_H_ */