Program: 228
Project: 228
Buggy source:
/** 
 * Process mouse clicks by setting/resetting visual mode. There are some strange scenerios to handle.
 * @param editor
 * @param event
 */
private void processMouseClick(Editor editor,MouseEvent event){
  int visualMode=0;
switch (event.getClickCount() % 3) {
case 1:
    visualMode=0;
  break;
case 2:
visualMode=Command.FLAG_MOT_CHARACTERWISE;
break;
case 0:
visualMode=Command.FLAG_MOT_LINEWISE;
if (CommandState.getInstance().getMode() == CommandState.MODE_VISUAL) {
CommandState.getInstance().popState();
}
break;
}
setVisualMode(editor,null,visualMode);
switch (CommandState.getInstance().getSubMode()) {
case 0:
VisualPosition vp=editor.getCaretModel().getVisualPosition();
int col=EditorHelper.normalizeVisualColumn(editor,vp.line,vp.column,CommandState.getInstance().getMode() == CommandState.MODE_INSERT || CommandState.getInstance().getMode() == CommandState.MODE_REPLACE);
if (col != vp.column) {
editor.getCaretModel().moveToVisualPosition(new VisualPosition(vp.line,col));
}
break;
case Command.FLAG_MOT_CHARACTERWISE:
BoundStringOption opt=(BoundStringOption)Options.getInstance().getOption("String_Node_Str");
int adj=1;
if (opt.getValue().equals("String_Node_Str")) {
adj=0;
}
editor.getCaretModel().moveToOffset(visualEnd - adj);
break;
case Command.FLAG_MOT_LINEWISE:
editor.getCaretModel().moveToLogicalPosition(editor.xyToLogicalPosition(event.getPoint()));
break;
}
EditorData.setLastColumn(editor,EditorHelper.getCurrentVisualColumn(editor));
logger.debug("String_Node_Str" + editor.getCaretModel().getVisualPosition() + "String_Node_Str"+ editor.getCaretModel().getLogicalPosition()+ "String_Node_Str"+ editor.getCaretModel().getOffset());
}

Fixed version (ground truth):
/** 
 * Process mouse clicks by setting/resetting visual mode. There are some strange scenerios to handle.
 * @param editor
 * @param event
 */
private void processMouseClick(Editor editor,MouseEvent event){
  int visualMode=0;
switch (event.getClickCount() % 3) {
case 1:
    visualMode=0;
  break;
case 2:
visualMode=Command.FLAG_MOT_CHARACTERWISE;
break;
case 0:
visualMode=Command.FLAG_MOT_LINEWISE;
if (CommandState.getInstance().getMode() == CommandState.MODE_VISUAL) {
CommandState.getInstance().popState();
}
int start=editor.getSelectionModel().getSelectionStart();
int end=editor.getSelectionModel().getSelectionEnd();
editor.getSelectionModel().setSelection(start,end - 1);
break;
}
setVisualMode(editor,null,visualMode);
switch (CommandState.getInstance().getSubMode()) {
case 0:
VisualPosition vp=editor.getCaretModel().getVisualPosition();
int col=EditorHelper.normalizeVisualColumn(editor,vp.line,vp.column,CommandState.getInstance().getMode() == CommandState.MODE_INSERT || CommandState.getInstance().getMode() == CommandState.MODE_REPLACE);
if (col != vp.column) {
editor.getCaretModel().moveToVisualPosition(new VisualPosition(vp.line,col));
}
break;
case Command.FLAG_MOT_CHARACTERWISE:
editor.getCaretModel().moveToOffset(visualEnd);
break;
case Command.FLAG_MOT_LINEWISE:
editor.getCaretModel().moveToLogicalPosition(editor.xyToLogicalPosition(event.getPoint()));
break;
}
visualOffset=editor.getCaretModel().getOffset();
EditorData.setLastColumn(editor,EditorHelper.getCurrentVisualColumn(editor));
logger.debug("String_Node_Str" + editor.getCaretModel().getVisualPosition() + "String_Node_Str"+ editor.getCaretModel().getLogicalPosition()+ "String_Node_Str"+ editor.getCaretModel().getOffset());
}