Program: 86794
Project: 86794
Buggy source:
public boolean keyDown(int key){
  if (!isActive) {
    return false;
  }
switch (key) {
case Keys.UP:
{
      if (!cmdHistory.isEmpty()) {
        cmdHistoryIndex++;
        if (cmdHistoryIndex >= cmdHistory.size()) {
          cmdHistoryIndex=0;
        }
        setInputText(cmdHistory.get(cmdHistoryIndex));
      }
      break;
    }
case Keys.DOWN:
{
    if (!cmdHistory.isEmpty()) {
      cmdHistoryIndex--;
      if (cmdHistoryIndex < 0) {
        cmdHistoryIndex=cmdHistory.size() - 1;
      }
      setInputText(cmdHistory.get(cmdHistoryIndex));
    }
    break;
  }
case Keys.LEFT:
{
  cursorIndex--;
  if (cursorIndex < 0) {
    cursorIndex=0;
  }
  break;
}
case Keys.RIGHT:
{
cursorIndex++;
if (cursorIndex >= inputBuffer.length()) {
  cursorIndex=inputBuffer.length();
}
break;
}
case Keys.HOME:
{
cursorIndex=0;
break;
}
case Keys.END:
{
cursorIndex=inputBuffer.length();
break;
}
case Keys.PAGE_UP:
{
scrollY=1;
break;
}
case Keys.PAGE_DOWN:
{
scrollY=-1;
break;
}
case Keys.TAB:
{
String inputText=inputBuffer.toString();
List<String> cmdNames=console.find(inputText);
if (!cmdNames.isEmpty()) {
if (cmdNames.size() == 1) {
setInputText(cmdNames.get(0) + "String_Node_Str");
}
 else {
console.println("String_Node_Str");
for (String cmd : cmdNames) {
console.println(cmd);
}
console.println("String_Node_Str");
setInputText(findMaxMatchingChars(inputText,cmdNames));
}
}
break;
}
case Keys.CONTROL_LEFT:
case Keys.CONTROL_RIGHT:
isCtrlDown=true;
break;
case Keys.V:
if (isCtrlDown) {
String contents=Gdx.app.getClipboard().getContents();
if (contents != null) {
inputBuffer.insert(cursorIndex,contents);
cursorIndex+=contents.length();
}
}
break;
default :
{
}
}
return true;
}

Fixed version (ground truth):
public boolean keyDown(int key){
  if (!isActive) {
    return false;
  }
switch (key) {
case Keys.UP:
{
      if (!cmdHistory.isEmpty()) {
        setInputText(cmdHistory.get(cmdHistoryIndex));
        cmdHistoryIndex--;
        if (cmdHistoryIndex < 0) {
          cmdHistoryIndex=cmdHistory.size() - 1;
        }
      }
      break;
    }
case Keys.DOWN:
{
    if (!cmdHistory.isEmpty()) {
      setInputText(cmdHistory.get(cmdHistoryIndex));
      cmdHistoryIndex++;
      if (cmdHistoryIndex >= cmdHistory.size()) {
        cmdHistoryIndex=0;
      }
    }
    break;
  }
case Keys.LEFT:
{
  cursorIndex--;
  if (cursorIndex < 0) {
    cursorIndex=0;
  }
  break;
}
case Keys.RIGHT:
{
cursorIndex++;
if (cursorIndex >= inputBuffer.length()) {
  cursorIndex=inputBuffer.length();
}
break;
}
case Keys.HOME:
{
cursorIndex=0;
break;
}
case Keys.END:
{
cursorIndex=inputBuffer.length();
break;
}
case Keys.PAGE_UP:
{
scrollY=1;
break;
}
case Keys.PAGE_DOWN:
{
scrollY=-1;
break;
}
case Keys.TAB:
{
String inputText=inputBuffer.toString();
List<String> cmdNames=console.find(inputText);
if (!cmdNames.isEmpty()) {
if (cmdNames.size() == 1) {
setInputText(cmdNames.get(0) + "String_Node_Str");
}
 else {
console.println("String_Node_Str");
for (String cmd : cmdNames) {
console.println(cmd);
}
console.println("String_Node_Str");
setInputText(findMaxMatchingChars(inputText,cmdNames));
}
}
break;
}
case Keys.CONTROL_LEFT:
case Keys.CONTROL_RIGHT:
isCtrlDown=true;
break;
case Keys.V:
if (isCtrlDown) {
String contents=Gdx.app.getClipboard().getContents();
if (contents != null) {
inputBuffer.insert(cursorIndex,contents);
cursorIndex+=contents.length();
}
}
break;
default :
{
}
}
return true;
}