bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bash 3.0 Official Patch 6


From: Chet Ramey
Subject: Bash 3.0 Official Patch 6
Date: Wed, 8 Sep 2004 15:48:24 -0400 (EDT)

                             BASH PATCH REPORT
                             =================

Bash-Release: 3.0
Patch-ID: bash30-006

Bug-Reported-by: address@hidden
                 Tomohiro KUBOTA <address@hidden>
Bug-Reference-ID: <address@hidden>
                  <address@hidden>
Bug-Reference-URL: 
http://lists.gnu.org/archive/html/bug-bash/2004-08/msg00006.html
                   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=257540

Bug-Description:

Prompts with multibyte characters or invisible characters following a line
wrap are displayed incorrectly.

Patch:

*** ../bash-3.0/lib/readline/display.c  Thu May 27 22:57:51 2004
--- lib/readline/display.c      Mon Aug 30 11:55:02 2004
***************
*** 202,206 ****
  {
    char *r, *ret, *p;
!   int l, rl, last, ignoring, ninvis, invfl, ind, pind, physchars;
  
    /* Short-circuit if we can. */
--- 202,206 ----
  {
    char *r, *ret, *p;
!   int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars;
  
    /* Short-circuit if we can. */
***************
*** 223,226 ****
--- 223,227 ----
  
    invfl = 0;  /* invisible chars in first line of prompt */
+   invflset = 0;       /* we only want to set invfl once */
  
    for (rl = ignoring = last = ninvis = physchars = 0, p = pmt; p && *p; p++)
***************
*** 250,254 ****
                *r++ = *p++;
              if (!ignoring)
!               rl += ind - pind;
              else
                ninvis += ind - pind;
--- 251,258 ----
                *r++ = *p++;
              if (!ignoring)
!               {
!                 rl += ind - pind;
!                 physchars += _rl_col_width (pmt, pind, ind);
!               }
              else
                ninvis += ind - pind;
***************
*** 260,273 ****
              *r++ = *p;
              if (!ignoring)
!               rl++;                   /* visible length byte counter */
              else
                ninvis++;               /* invisible chars byte counter */
            }
  
!         if (rl >= _rl_screenwidth)
!           invfl = ninvis;
! 
!         if (ignoring == 0)
!           physchars++;
        }
      }
--- 264,280 ----
              *r++ = *p;
              if (!ignoring)
!               {
!                 rl++;                 /* visible length byte counter */
!                 physchars++;
!               }
              else
                ninvis++;               /* invisible chars byte counter */
            }
  
!         if (invflset == 0 && rl >= _rl_screenwidth)
!           {
!             invfl = ninvis;
!             invflset = 1;
!           }
        }
      }
***************
*** 418,422 ****
    register char *line;
    int c_pos, inv_botlin, lb_botlin, lb_linenum;
!   int newlines, lpos, temp, modmark;
    char *prompt_this_line;
  #if defined (HANDLE_MULTIBYTE)
--- 425,429 ----
    register char *line;
    int c_pos, inv_botlin, lb_botlin, lb_linenum;
!   int newlines, lpos, temp, modmark, n0, num;
    char *prompt_this_line;
  #if defined (HANDLE_MULTIBYTE)
***************
*** 574,577 ****
--- 581,585 ----
  #if defined (HANDLE_MULTIBYTE)
    memset (_rl_wrapped_line, 0, vis_lbsize);
+   num = 0;
  #endif
  
***************
*** 592,596 ****
--- 600,619 ----
           prompts that exceed two physical lines?
           Additional logic fix from Edward Catmur <address@hidden> */
+ #if defined (HANDLE_MULTIBYTE)
+       n0 = num;
+       temp = local_prompt ? strlen (local_prompt) : 0;
+       while (num < temp)
+       {
+         if (_rl_col_width  (local_prompt, n0, num) > _rl_screenwidth)
+           {
+             num = _rl_find_prev_mbchar (local_prompt, num, MB_FIND_ANY);
+             break;
+           }
+         num++;
+       }
+       temp = num +
+ #else
        temp = ((newlines + 1) * _rl_screenwidth) +
+ #endif /* !HANDLE_MULTIBYTE */
               ((local_prompt_prefix == 0) ? ((newlines == 0) ? 
prompt_invis_chars_first_line
                                                            : ((newlines == 1) 
? wrap_offset : 0))
***************
*** 598,602 ****
--- 621,629 ----
               
        inv_lbreaks[++newlines] = temp;
+ #if defined (HANDLE_MULTIBYTE)
+       lpos -= _rl_col_width (local_prompt, n0, num);
+ #else
        lpos -= _rl_screenwidth;
+ #endif
      }
  

*** ../bash-3.0/patchlevel.h    Wed Aug 22 08:05:39 2001
--- patchlevel.h        Thu Sep  2 15:04:32 2004
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 5
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 6
  
  #endif /* _PATCHLEVEL_H_ */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]