Program: 254
Project: 254
Buggy source:
public void indentRange(Editor editor,DataContext context,TextRange range,int count,int dir){
  if (range == null)   return;
  Project proj=(Project)context.getData(DataConstants.PROJECT);
  int tabSize=editor.getSettings().getTabSize(proj);
  boolean useTabs=editor.getSettings().isUseTabCharacter(proj);
  int sline=editor.offsetToLogicalPosition(range.getStartOffset()).line;
  int eline=editor.offsetToLogicalPosition(range.getEndOffset()).line;
  int eoff=EditorHelper.getLineStartForOffset(editor,range.getEndOffset());
  if (eoff == range.getEndOffset()) {
    eline--;
  }
  for (int l=sline; l <= eline; l++) {
    int soff=editor.getDocument().getLineStartOffset(l);
    int woff=CommandGroups.getInstance().getMotion().moveCaretToLineStartSkipLeading(editor,l);
    int col=editor.offsetToVisualPosition(woff).column;
    int newCol=Math.max(0,col + dir * tabSize * count);
    if (dir == 1 || col > 0) {
      StringBuffer space=new StringBuffer();
      int tabCnt=0;
      int spcCnt=0;
      if (useTabs) {
        tabCnt=newCol / tabSize;
        spcCnt=newCol % tabSize;
      }
 else {
        spcCnt=newCol;
      }
      for (int i=0; i < tabCnt; i++) {
        space.append('\t');
      }
      for (int i=0; i < spcCnt; i++) {
        space.append(' ');
      }
      replaceText(editor,context,soff,woff,space.toString());
    }
  }
  if (CommandState.getInstance().getMode() != CommandState.MODE_INSERT && CommandState.getInstance().getMode() != CommandState.MODE_REPLACE) {
    MotionGroup.moveCaret(editor,context,CommandGroups.getInstance().getMotion().moveCaretToLineStartSkipLeading(editor,sline));
  }
  EditorData.setLastColumn(editor,editor.getCaretModel().getVisualPosition().column);
}

Fixed version (ground truth):
public void indentRange(Editor editor,DataContext context,TextRange range,int count,int dir){
  if (range == null)   return;
  Project proj=(Project)context.getData(DataConstants.PROJECT);
  int tabSize=editor.getSettings().getTabSize(proj);
  boolean useTabs=editor.getSettings().isUseTabCharacter(proj);
  int sline=editor.offsetToLogicalPosition(range.getStartOffset()).line;
  int eline=editor.offsetToLogicalPosition(range.getEndOffset()).line;
  int eoff=EditorHelper.getLineStartForOffset(editor,range.getEndOffset());
  if (eoff == range.getEndOffset()) {
    eline--;
  }
  for (int l=sline; l <= eline; l++) {
    int soff=EditorHelper.getLineStartOffset(editor,l);
    int woff=CommandGroups.getInstance().getMotion().moveCaretToLineStartSkipLeading(editor,l);
    int col=editor.offsetToVisualPosition(woff).column;
    int newCol=Math.max(0,col + dir * tabSize * count);
    if (dir == 1 || col > 0) {
      StringBuffer space=new StringBuffer();
      int tabCnt=0;
      int spcCnt=0;
      if (useTabs) {
        tabCnt=newCol / tabSize;
        spcCnt=newCol % tabSize;
      }
 else {
        spcCnt=newCol;
      }
      for (int i=0; i < tabCnt; i++) {
        space.append('\t');
      }
      for (int i=0; i < spcCnt; i++) {
        space.append(' ');
      }
      replaceText(editor,context,soff,woff,space.toString());
    }
  }
  if (CommandState.getInstance().getMode() != CommandState.MODE_INSERT && CommandState.getInstance().getMode() != CommandState.MODE_REPLACE) {
    MotionGroup.moveCaret(editor,context,CommandGroups.getInstance().getMotion().moveCaretToLineStartSkipLeading(editor,sline));
  }
  EditorData.setLastColumn(editor,editor.getCaretModel().getVisualPosition().column);
}