Program: 143942
Project: 143942
Buggy source:
/** 
 * Redraw marked lines.
 * @see #markLine
 */
public void redraw(){
  if (debug > 0)   System.err.println("String_Node_Str");
  update[0]=true;
  if (backingStore == null || screenLocked)   return;
  Graphics g=backingStore.getGraphics();
  if (debug > 0) {
    System.err.println("String_Node_Str" + g.getClipBounds());
    System.err.println("String_Node_Str");
    for (int l=0; l < size.height; l++)     if (update[l])     System.err.println("String_Node_Str" + l + "String_Node_Str"+ update[l]);
  }
  int xoffset=(super.getSize().width - size.width * charWidth) / 2;
  int yoffset=(super.getSize().height - size.height * charHeight) / 2;
  Color fg=color[COLOR_FG_STD];
  Color bg=color[COLOR_BG_STD];
  g.setFont(normalFont);
  for (int l=0; l < size.height; l++) {
    if (update[0] && !update[l + 1])     continue;
    update[l + 1]=false;
    for (int c=0; c < size.width; c++) {
      int addr=0;
      int currAttr=charAttributes[windowBase + l][c];
      fg=getForeground();
      bg=getBackground();
      if (((currAttr & BOLD) != 0) && ((currAttr & COLOR_FG) == 0) && ((currAttr & COLOR_BG) == 0))       fg=color[COLOR_FG_BOLD];
      if ((currAttr & COLOR_FG) != 0)       fg=color[((currAttr & COLOR_FG) >> 3) - 1];
      if ((currAttr & COLOR_BG) != 0)       bg=color[((currAttr & COLOR_BG) >> 7) - 1];
      if ((currAttr & BOLD) != 0)       if (fg.equals(Color.black))       fg=Color.gray;
 else {
        fg=fg.brighter();
        bg=bg.brighter();
      }
      if ((currAttr & INVERT) != 0) {
        Color swapc=bg;
        bg=fg;
        fg=swapc;
      }
      if (sf.inSoftFont(charArray[windowBase + l][c])) {
        g.setColor(bg);
        g.fillRect(c * charWidth + xoffset,l * charHeight + yoffset,charWidth,charHeight);
        g.setColor(fg);
        sf.drawChar(g,charArray[windowBase + l][c],xoffset + c * charWidth,l * charHeight + yoffset,charWidth,charHeight);
        if ((currAttr & UNDERLINE) != 0)         g.drawLine(c * charWidth + xoffset,(l + 1) * charHeight - charDescent / 2 + yoffset,c * charWidth + charWidth + xoffset,(l + 1) * charHeight - charDescent / 2 + yoffset);
        continue;
      }
      while (c + addr < size.width && charAttributes[windowBase + l][c + addr] == currAttr && !sf.inSoftFont(charArray[windowBase + l][c + addr])) {
        if (charArray[windowBase + l][c + addr] < ' ')         charArray[windowBase + l][c + addr]=' ';
        addr++;
      }
      g.setColor(bg);
      g.fillRect(c * charWidth + xoffset,l * charHeight + yoffset,addr * charWidth,charHeight);
      g.setColor(fg);
      g.drawChars(charArray[windowBase + l],c,addr,c * charWidth + xoffset,(l + 1) * charHeight - charDescent + yoffset);
      if ((currAttr & UNDERLINE) != 0)       g.drawLine(c * charWidth + xoffset,(l + 1) * charHeight - charDescent / 2 + yoffset,c * charWidth + addr * charWidth + xoffset,(l + 1) * charHeight - charDescent / 2 + yoffset);
      c+=addr - 1;
    }
  }
  if (screenBase + cursorY >= windowBase && screenBase + cursorY < windowBase + size.height) {
    g.setColor(color[COLOR_FG_STD]);
    g.setXORMode(color[COLOR_BG_STD]);
    g.fillRect(cursorX * charWidth + xoffset,(cursorY + screenBase - windowBase) * charHeight + yoffset,charWidth,charHeight);
    g.setPaintMode();
  }
  if (windowBase <= selectBegin.y || windowBase <= selectEnd.y) {
    int beginLine=selectBegin.y - windowBase;
    int endLine=selectEnd.y - selectBegin.y;
    if (beginLine < 0) {
      endLine+=beginLine;
      beginLine=0;
    }
    if (endLine > size.height)     endLine=size.height - beginLine;
    g.setXORMode(color[COLOR_BG_STD]);
    g.fillRect(selectBegin.x * charWidth + xoffset,beginLine * charHeight + yoffset,(endLine == 0 ? (selectEnd.x - selectBegin.x) : (size.width - selectBegin.x)) * charWidth,charHeight);
    if (endLine > 1)     g.fillRect(0 + xoffset,(beginLine + 1) * charHeight + yoffset,size.width * charWidth,(endLine - 1) * charHeight);
    if (endLine > 0)     g.fillRect(0 + xoffset,(beginLine + endLine) * charHeight + yoffset,selectEnd.x * charWidth,charHeight);
    g.setPaintMode();
  }
  if (insets != null) {
    g.setColor(getBackground());
    xoffset--;
    yoffset--;
    for (int i=insets.top - 1; i >= 0; i--)     g.draw3DRect(xoffset - i,yoffset - i,charWidth * size.width + 1 + i * 2,charHeight * size.height + 1 + i * 2,raised);
  }
  update[0]=false;
  repaint();
}

Fixed version (ground truth):
/** 
 * Redraw marked lines.
 * @see #markLine
 */
public void redraw(){
  if (debug > 0)   System.err.println("String_Node_Str");
  if (backingStore != null) {
    Graphics g=backingStore.getGraphics();
    int xoffset=(super.getSize().width - size.width * charWidth) / 2;
    int yoffset=(super.getSize().height - size.height * charHeight) / 2;
    Color fg=color[COLOR_FG_STD];
    Color bg=color[COLOR_BG_STD];
    g.setFont(normalFont);
    for (int l=0; l < size.height; l++) {
      if (!update[0] && !update[l + 1])       continue;
      update[l + 1]=false;
      for (int c=0; c < size.width; c++) {
        int addr=0;
        int currAttr=charAttributes[windowBase + l][c];
        fg=getForeground();
        bg=getBackground();
        if (((currAttr & BOLD) != 0) && ((currAttr & COLOR_FG) == 0) && ((currAttr & COLOR_BG) == 0))         fg=color[COLOR_FG_BOLD];
        if ((currAttr & COLOR_FG) != 0)         fg=color[((currAttr & COLOR_FG) >> 3) - 1];
        if ((currAttr & COLOR_BG) != 0)         bg=color[((currAttr & COLOR_BG) >> 7) - 1];
        if ((currAttr & BOLD) != 0)         if (fg.equals(Color.black))         fg=Color.gray;
 else {
          fg=fg.brighter();
          bg=bg.brighter();
        }
        if ((currAttr & INVERT) != 0) {
          Color swapc=bg;
          bg=fg;
          fg=swapc;
        }
        if (sf.inSoftFont(charArray[windowBase + l][c])) {
          g.setColor(bg);
          g.fillRect(c * charWidth + xoffset,l * charHeight + yoffset,charWidth,charHeight);
          g.setColor(fg);
          sf.drawChar(g,charArray[windowBase + l][c],xoffset + c * charWidth,l * charHeight + yoffset,charWidth,charHeight);
          if ((currAttr & UNDERLINE) != 0)           g.drawLine(c * charWidth + xoffset,(l + 1) * charHeight - charDescent / 2 + yoffset,c * charWidth + charWidth + xoffset,(l + 1) * charHeight - charDescent / 2 + yoffset);
          continue;
        }
        while (c + addr < size.width && charAttributes[windowBase + l][c + addr] == currAttr && !sf.inSoftFont(charArray[windowBase + l][c + addr])) {
          if (charArray[windowBase + l][c + addr] < ' ')           charArray[windowBase + l][c + addr]=' ';
          addr++;
        }
        g.setColor(bg);
        g.fillRect(c * charWidth + xoffset,l * charHeight + yoffset,addr * charWidth,charHeight);
        g.setColor(fg);
        g.drawChars(charArray[windowBase + l],c,addr,c * charWidth + xoffset,(l + 1) * charHeight - charDescent + yoffset);
        if ((currAttr & UNDERLINE) != 0)         g.drawLine(c * charWidth + xoffset,(l + 1) * charHeight - charDescent / 2 + yoffset,c * charWidth + addr * charWidth + xoffset,(l + 1) * charHeight - charDescent / 2 + yoffset);
        c+=addr - 1;
      }
    }
    if (screenBase + cursorY >= windowBase && screenBase + cursorY < windowBase + size.height) {
      g.setColor(color[COLOR_FG_STD]);
      g.setXORMode(color[COLOR_BG_STD]);
      g.fillRect(cursorX * charWidth + xoffset,(cursorY + screenBase - windowBase) * charHeight + yoffset,charWidth,charHeight);
      g.setPaintMode();
    }
    if (windowBase <= selectBegin.y || windowBase <= selectEnd.y) {
      int beginLine=selectBegin.y - windowBase;
      int endLine=selectEnd.y - selectBegin.y;
      if (beginLine < 0) {
        endLine+=beginLine;
        beginLine=0;
      }
      if (endLine > size.height)       endLine=size.height - beginLine;
      g.setXORMode(color[COLOR_BG_STD]);
      g.fillRect(selectBegin.x * charWidth + xoffset,beginLine * charHeight + yoffset,(endLine == 0 ? (selectEnd.x - selectBegin.x) : (size.width - selectBegin.x)) * charWidth,charHeight);
      if (endLine > 1)       g.fillRect(0 + xoffset,(beginLine + 1) * charHeight + yoffset,size.width * charWidth,(endLine - 1) * charHeight);
      if (endLine > 0)       g.fillRect(0 + xoffset,(beginLine + endLine) * charHeight + yoffset,selectEnd.x * charWidth,charHeight);
      g.setPaintMode();
    }
    if (insets != null) {
      g.setColor(getBackground());
      xoffset--;
      yoffset--;
      for (int i=insets.top - 1; i >= 0; i--)       g.draw3DRect(xoffset - i,yoffset - i,charWidth * size.width + 1 + i * 2,charHeight * size.height + 1 + i * 2,raised);
    }
    update[0]=false;
  }
  repaint();
}