Program: 37659
Project: 37659
Buggy source:
EditFrame(RopeFrame parent){
  super(parent);
  setLocation(0,0);
  setSize(670,668);
  try {
    jbInit();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
  sourceArea.addCaretListener(this);
  browseButton.addActionListener(this);
  optionsButton.addActionListener(this);
  assembleButton.addActionListener(this);
  saveButton.addActionListener(this);
  saveMessagesButton.addActionListener(this);
  messageList.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent event){
      highlightError(messageList.locationToIndex(event.getPoint()));
    }
  }
);
  undoMgr=new CompoundUndoManager(sourceArea);
  undoAction=undoMgr.getUndoAction();
  redoAction=undoMgr.getRedoAction();
  undoMgr.updateUndoAction=new UpdateUndoAction();
  undoMgr.updateRedoAction=new UpdateRedoAction();
  document=sourceArea.getDocument();
  ActionMap am=sourceArea.getActionMap();
  InputMap im=sourceArea.getInputMap(JComponent.WHEN_FOCUSED);
  im.put(KeyStroke.getKeyStroke(KeyEvent.VK_Z,RopeHelper.modifierMaks),"String_Node_Str");
  im.put(KeyStroke.getKeyStroke(KeyEvent.VK_Z,RopeHelper.modifierMaks + InputEvent.SHIFT_MASK),"String_Node_Str");
  im.put(KeyStroke.getKeyStroke(KeyEvent.VK_X,RopeHelper.modifierMaks),"String_Node_Str");
  im.put(KeyStroke.getKeyStroke(KeyEvent.VK_C,RopeHelper.modifierMaks),"String_Node_Str");
  im.put(KeyStroke.getKeyStroke(KeyEvent.VK_V,RopeHelper.modifierMaks),"String_Node_Str");
  im.put(KeyStroke.getKeyStroke(KeyEvent.VK_A,RopeHelper.modifierMaks),"String_Node_Str");
  im.put(KeyStroke.getKeyStroke(KeyEvent.VK_L,RopeHelper.modifierMaks),"String_Node_Str");
  String action="String_Node_Str";
  im.put(KeyStroke.getKeyStroke("String_Node_Str"),action);
  am.put(action,new AbstractAction(){
    private static final long serialVersionUID=1L;
    @Override public void actionPerformed(    ActionEvent e){
      try {
        int caretPos=sourceArea.getCaretPosition();
        int lineNum=sourceArea.getLineOfOffset(caretPos);
        int startLine=sourceArea.getLineStartOffset(lineNum);
        int endLine=sourceArea.getLineEndOffset(lineNum);
        int linePos=caretPos - startLine;
        if (linePos >= 39 && linePos < 79) {
          caretPos=startLine + linePos + 10 - ((linePos + 1) % 10);
        }
 else         if (linePos >= 20 && linePos <= 39) {
          caretPos=startLine + 39;
        }
 else         if (linePos >= 15 && linePos <= 19) {
          caretPos=startLine + 20;
        }
 else         if (linePos >= 5 && linePos <= 14) {
          caretPos=startLine + 15;
        }
 else {
          caretPos=startLine + 5;
        }
        if (caretPos > endLine) {
          StringBuilder str=new StringBuilder();
          int size=caretPos - endLine;
          while (size-- >= 0) {
            str.append(' ');
          }
          document.insertString(endLine - 1,str.toString(),null);
        }
        sourceArea.setCaretPosition(caretPos);
      }
 catch (      BadLocationException ex) {
        ex.printStackTrace();
      }
    }
  }
);
  String actionKey="String_Node_Str";
  im.put(KeyStroke.getKeyStroke("String_Node_Str"),actionKey);
  am.put(actionKey,new AbstractAction(){
    private static final long serialVersionUID=1L;
    @Override public void actionPerformed(    ActionEvent e){
      try {
        int caretPos=sourceArea.getCaretPosition();
        int lineNum=sourceArea.getLineOfOffset(caretPos);
        int startLine=sourceArea.getLineStartOffset(lineNum);
        int endLine=sourceArea.getLineEndOffset(lineNum);
        int linePos=caretPos - startLine;
        if (linePos == 15) {
          int endPos=5;
          int charPos=linePos;
          for (; charPos > endPos; charPos--) {
            char ch=sourceArea.getText().charAt((startLine + charPos) - 1);
            if (!Character.isWhitespace(ch)) {
              break;
            }
          }
          sourceArea.setCaretPosition(startLine + charPos);
        }
 else {
          int startSel=sourceArea.getSelectionStart();
          int endSel=sourceArea.getSelectionEnd();
          if (startSel == endSel) {
            startSel=caretPos - 1;
            endSel=caretPos;
          }
          StringBuilder sb=new StringBuilder(sourceArea.getText());
          sb.replace(startSel,endSel,"String_Node_Str");
          sourceArea.setText(sb.toString());
          sourceArea.setCaretPosition(startSel);
        }
      }
 catch (      BadLocationException ex) {
        ex.printStackTrace();
      }
    }
  }
);
  action="String_Node_Str";
  im.put(KeyStroke.getKeyStroke("String_Node_Str"),action);
  am.put(action,new AbstractAction(){
    private static final long serialVersionUID=1L;
    @Override public void actionPerformed(    ActionEvent e){
      try {
        int caretPos=sourceArea.getCaretPosition();
        int lineNum=sourceArea.getLineOfOffset(caretPos);
        int startLine=sourceArea.getLineStartOffset(lineNum);
        int linePos=caretPos - startLine;
        if (linePos >= 5) {
          document.insertString(caretPos,"String_Node_Str",null);
        }
 else {
          document.insertString(caretPos,"String_Node_Str",null);
        }
      }
 catch (      BadLocationException ex) {
        ex.printStackTrace();
      }
    }
  }
);
  document.addDocumentListener(new DocumentListener(){
    @Override public void insertUpdate(    DocumentEvent e){
      setSourceChanged(true);
    }
    @Override public void removeUpdate(    DocumentEvent e){
      setSourceChanged(true);
    }
    @Override public void changedUpdate(    DocumentEvent e){
      setSourceChanged(true);
    }
  }
);
}

Fixed version (ground truth):
EditFrame(RopeFrame parent){
  super(parent);
  setLocation(0,0);
  setSize(670,668);
  try {
    jbInit();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
  sourceArea.addCaretListener(this);
  browseButton.addActionListener(this);
  optionsButton.addActionListener(this);
  assembleButton.addActionListener(this);
  saveButton.addActionListener(this);
  saveMessagesButton.addActionListener(this);
  messageList.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent event){
      highlightError(messageList.locationToIndex(event.getPoint()));
    }
  }
);
  undoMgr=new CompoundUndoManager(sourceArea);
  undoAction=undoMgr.getUndoAction();
  redoAction=undoMgr.getRedoAction();
  undoMgr.updateUndoAction=new UpdateUndoAction();
  undoMgr.updateRedoAction=new UpdateRedoAction();
  document=sourceArea.getDocument();
  ActionMap am=sourceArea.getActionMap();
  InputMap im=sourceArea.getInputMap(JComponent.WHEN_FOCUSED);
  im.put(KeyStroke.getKeyStroke(KeyEvent.VK_Z,RopeHelper.modifierMaks),"String_Node_Str");
  im.put(KeyStroke.getKeyStroke(KeyEvent.VK_Z,RopeHelper.modifierMaks + InputEvent.SHIFT_MASK),"String_Node_Str");
  im.put(KeyStroke.getKeyStroke(KeyEvent.VK_X,RopeHelper.modifierMaks),"String_Node_Str");
  im.put(KeyStroke.getKeyStroke(KeyEvent.VK_C,RopeHelper.modifierMaks),"String_Node_Str");
  im.put(KeyStroke.getKeyStroke(KeyEvent.VK_V,RopeHelper.modifierMaks),"String_Node_Str");
  im.put(KeyStroke.getKeyStroke(KeyEvent.VK_A,RopeHelper.modifierMaks),"String_Node_Str");
  im.put(KeyStroke.getKeyStroke(KeyEvent.VK_L,RopeHelper.modifierMaks),"String_Node_Str");
  String action="String_Node_Str";
  im.put(KeyStroke.getKeyStroke("String_Node_Str"),action);
  am.put(action,new AbstractAction(){
    private static final long serialVersionUID=1L;
    @Override public void actionPerformed(    ActionEvent e){
      try {
        int caretPos=sourceArea.getCaretPosition();
        int lineNum=sourceArea.getLineOfOffset(caretPos);
        int startLine=sourceArea.getLineStartOffset(lineNum);
        int endLine=sourceArea.getLineEndOffset(lineNum);
        int linePos=caretPos - startLine;
        if (linePos >= 39 && linePos < 79) {
          caretPos=startLine + linePos + 10 - ((linePos + 1) % 10);
        }
 else         if (linePos >= 20 && linePos <= 39) {
          caretPos=startLine + 39;
        }
 else         if (linePos >= 15 && linePos <= 19) {
          caretPos=startLine + 20;
        }
 else         if (linePos >= 5 && linePos <= 14) {
          caretPos=startLine + 15;
        }
 else {
          caretPos=startLine + 5;
        }
        if (caretPos > endLine) {
          StringBuilder str=new StringBuilder();
          int size=caretPos - endLine;
          while (size-- >= 0) {
            str.append(' ');
          }
          document.insertString(endLine - 1,str.toString(),null);
        }
        sourceArea.setCaretPosition(caretPos);
      }
 catch (      BadLocationException ex) {
        ex.printStackTrace();
      }
    }
  }
);
  String actionKey="String_Node_Str";
  im.put(KeyStroke.getKeyStroke("String_Node_Str"),actionKey);
  am.put(actionKey,new AbstractAction(){
    private static final long serialVersionUID=1L;
    @Override public void actionPerformed(    ActionEvent e){
      try {
        int caretPos=sourceArea.getCaretPosition();
        int lineNum=sourceArea.getLineOfOffset(caretPos);
        int startLine=sourceArea.getLineStartOffset(lineNum);
        int endLine=sourceArea.getLineEndOffset(lineNum);
        int linePos=caretPos - startLine;
        if (linePos == 15) {
          int endPos=5;
          int charPos=linePos;
          for (; charPos > endPos; charPos--) {
            char ch=sourceArea.getText().charAt((startLine + charPos) - 1);
            if (!Character.isWhitespace(ch)) {
              break;
            }
          }
          sourceArea.setCaretPosition(startLine + charPos);
        }
 else {
          int startSel=sourceArea.getSelectionStart();
          int endSel=sourceArea.getSelectionEnd();
          if (startSel == endSel) {
            startSel=caretPos - 1;
            endSel=caretPos;
          }
          StringBuilder sb=new StringBuilder(sourceArea.getText());
          sb.replace(startSel,endSel,"String_Node_Str");
          sourceArea.setText(sb.toString());
          sourceArea.setCaretPosition(startSel);
        }
      }
 catch (      BadLocationException ex) {
        ex.printStackTrace();
      }
    }
  }
);
  action="String_Node_Str";
  im.put(KeyStroke.getKeyStroke("String_Node_Str"),action);
  am.put(action,new AbstractAction(){
    private static final long serialVersionUID=1L;
    @Override public void actionPerformed(    ActionEvent e){
      try {
        int caretPos=sourceArea.getCaretPosition();
        int lineNum=sourceArea.getLineOfOffset(caretPos);
        int startLine=sourceArea.getLineStartOffset(lineNum);
        int linePos=caretPos - startLine;
        if (linePos >= 5) {
          document.insertString(caretPos,"String_Node_Str",null);
        }
 else {
          document.insertString(caretPos,"String_Node_Str",null);
        }
      }
 catch (      BadLocationException ex) {
        ex.printStackTrace();
      }
    }
  }
);
  document.addDocumentListener(new DocumentListener(){
    @Override public void insertUpdate(    DocumentEvent e){
      setSourceChanged(true);
    }
    @Override public void removeUpdate(    DocumentEvent e){
      setSourceChanged(true);
    }
    @Override public void changedUpdate(    DocumentEvent e){
      setSourceChanged(true);
    }
  }
);
  this.addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      fileText.setText(sourcePath);
    }
  }
);
}