Program: 218
Project: 218
Buggy source:
/** 
 * This sets up some listeners so we can handle various events that occur
 */
private void setupListeners(){
  DocumentManager.getInstance().addDocumentListener(new MarkGroup.MarkUpdater());
  DocumentManager.getInstance().addDocumentListener(new SearchGroup.DocumentSearchListener());
  DocumentManager.getInstance().init();
  EditorFactory.getInstance().addEditorFactoryListener(new EditorFactoryAdapter(){
    public void editorCreated(    EditorFactoryEvent event){
      final Editor editor=event.getEditor();
      isBlockCursor=editor.getSettings().isBlockCursor();
      isSmoothScrolling=editor.getSettings().isAnimatedScrolling();
      EditorData.initializeEditor(editor);
      DocumentManager.getInstance().addListeners(editor.getDocument());
      if (VimPlugin.isEnabled()) {
        final VirtualFile virtualFile=EditorData.getVirtualFile(editor);
        if (virtualFile == null || virtualFile instanceof LightVirtualFile) {
          CommandGroups.getInstance().getChange().insertBeforeCursor(editor,new EditorDataContext(editor));
        }
        editor.getSettings().setBlockCursor(!CommandState.inInsertMode(editor));
        editor.getSettings().setAnimatedScrolling(false);
      }
    }
    public void editorReleased(    EditorFactoryEvent event){
      EditorData.uninitializeEditor(event.getEditor());
      event.getEditor().getSettings().setAnimatedScrolling(isSmoothScrolling);
      DocumentManager.getInstance().removeListeners(event.getEditor().getDocument());
    }
  }
);
  ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter(){
    public void projectOpened(    Project project){
      listeners.add(new MotionGroup.MotionEditorChange());
      listeners.add(new FileGroup.SelectionCheck());
      listeners.add(new SearchGroup.EditorSelectionCheck());
      for (      FileEditorManagerListener listener : listeners) {
        FileEditorManager.getInstance(project).addFileEditorManagerListener(listener);
      }
      myLookupPropertiesListener=new PropertyChangeListener(){
        @Override public void propertyChange(        PropertyChangeEvent evt){
          if (LookupManager.PROP_ACTIVE_LOOKUP.equals(evt.getPropertyName())) {
            final Lookup lookup=(Lookup)evt.getNewValue();
            if (lookup != null) {
              final Editor editor=lookup.getEditor();
              CommandGroups.getInstance().getChange().insertBeforeCursor(editor,new EditorDataContext(editor));
            }
          }
        }
      }
;
      LookupManager.getInstance(project).addPropertyChangeListener(myLookupPropertiesListener);
    }
    public void projectClosed(    Project project){
      for (      FileEditorManagerListener listener : listeners) {
        FileEditorManager.getInstance(project).removeFileEditorManagerListener(listener);
      }
      LookupManager.getInstance(project).removePropertyChangeListener(myLookupPropertiesListener);
      listeners.clear();
    }
    ArrayList<FileEditorManagerListener> listeners=new ArrayList<FileEditorManagerListener>();
  }
);
  CommandProcessor.getInstance().addCommandListener(DelegateCommandListener.getInstance());
}

Fixed version (ground truth):
/** 
 * This sets up some listeners so we can handle various events that occur
 */
private void setupListeners(){
  DocumentManager.getInstance().addDocumentListener(new MarkGroup.MarkUpdater());
  DocumentManager.getInstance().addDocumentListener(new SearchGroup.DocumentSearchListener());
  DocumentManager.getInstance().init();
  EditorFactory.getInstance().addEditorFactoryListener(new EditorFactoryAdapter(){
    public void editorCreated(    EditorFactoryEvent event){
      final Editor editor=event.getEditor();
      isBlockCursor=editor.getSettings().isBlockCursor();
      isSmoothScrolling=editor.getSettings().isAnimatedScrolling();
      EditorData.initializeEditor(editor);
      DocumentManager.getInstance().addListeners(editor.getDocument());
      if (VimPlugin.isEnabled()) {
        if (!EditorData.isFileEditor(editor)) {
          CommandGroups.getInstance().getChange().insertBeforeCursor(editor,new EditorDataContext(editor));
        }
        editor.getSettings().setBlockCursor(!CommandState.inInsertMode(editor));
        editor.getSettings().setAnimatedScrolling(false);
      }
    }
    public void editorReleased(    EditorFactoryEvent event){
      EditorData.uninitializeEditor(event.getEditor());
      event.getEditor().getSettings().setAnimatedScrolling(isSmoothScrolling);
      DocumentManager.getInstance().removeListeners(event.getEditor().getDocument());
    }
  }
);
  ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter(){
    public void projectOpened(    Project project){
      listeners.add(new MotionGroup.MotionEditorChange());
      listeners.add(new FileGroup.SelectionCheck());
      listeners.add(new SearchGroup.EditorSelectionCheck());
      for (      FileEditorManagerListener listener : listeners) {
        FileEditorManager.getInstance(project).addFileEditorManagerListener(listener);
      }
      myLookupPropertiesListener=new PropertyChangeListener(){
        @Override public void propertyChange(        PropertyChangeEvent evt){
          if (LookupManager.PROP_ACTIVE_LOOKUP.equals(evt.getPropertyName())) {
            final Lookup lookup=(Lookup)evt.getNewValue();
            if (lookup != null && lookup.isFocused()) {
              final Editor editor=lookup.getEditor();
              if (!CommandState.inInsertMode(editor)) {
                CommandGroups.getInstance().getChange().insertBeforeCursor(editor,new EditorDataContext(editor));
              }
            }
          }
        }
      }
;
      LookupManager.getInstance(project).addPropertyChangeListener(myLookupPropertiesListener);
    }
    public void projectClosed(    Project project){
      for (      FileEditorManagerListener listener : listeners) {
        FileEditorManager.getInstance(project).removeFileEditorManagerListener(listener);
      }
      LookupManager.getInstance(project).removePropertyChangeListener(myLookupPropertiesListener);
      listeners.clear();
    }
    ArrayList<FileEditorManagerListener> listeners=new ArrayList<FileEditorManagerListener>();
  }
);
  CommandProcessor.getInstance().addCommandListener(DelegateCommandListener.getInstance());
}