Program: 31117
Project: 31117
Buggy source:
@Override public void keyPressed(Canvas canvas,KeyEvent event){
  processKeyEvent(canvas,event,KeyConfigurationEvent.KEY_PRESSED);
  if (!event.isConsumed() && event.getModifiersEx() == 0) {
    int KeybEvent=event.getKeyCode();
    String Component=(getFactory() == null) ? "String_Node_Str" : getFactory().getDisplayName();
    if (!GateKeyboardModifier.TookKeyboardStrokes(KeybEvent,null,attrs,canvas,null,false))     if (AutoLabler.LabelKeyboardHandler(KeybEvent,getAttributeSet(),Component,null,canvas.getCircuit(),null,false)) {
      canvas.repaint();
    }
 else switch (KeybEvent) {
case KeyEvent.VK_UP:
      setFacing(canvas,Direction.NORTH);
    break;
case KeyEvent.VK_DOWN:
  setFacing(canvas,Direction.SOUTH);
break;
case KeyEvent.VK_LEFT:
setFacing(canvas,Direction.WEST);
break;
case KeyEvent.VK_RIGHT:
setFacing(canvas,Direction.EAST);
break;
case KeyEvent.VK_R:
Direction current=getFacing();
if (current == Direction.NORTH) setFacing(canvas,Direction.EAST);
 else if (current == Direction.EAST) setFacing(canvas,Direction.SOUTH);
 else if (current == Direction.SOUTH) setFacing(canvas,Direction.WEST);
 else setFacing(canvas,Direction.NORTH);
break;
case KeyEvent.VK_ESCAPE:
Project proj=canvas.getProject();
Library base=proj.getLogisimFile().getLibrary("String_Node_Str");
Tool next=(base == null) ? null : base.getTool("String_Node_Str");
if (next != null) {
proj.setTool(next);
Action act=SelectionActions.dropAll(canvas.getSelection());
if (act != null) {
proj.doAction(act);
}
}
break;
case KeyEvent.VK_BACK_SPACE:
if (lastAddition != null && canvas.getProject().getLastAction() == lastAddition) {
canvas.getProject().undoAction();
lastAddition=null;
}
}
}
}

Fixed version (ground truth):
@Override public void keyPressed(Canvas canvas,KeyEvent event){
  processKeyEvent(canvas,event,KeyConfigurationEvent.KEY_PRESSED);
  if (!event.isConsumed() && event.getModifiersEx() == 0) {
    int KeybEvent=event.getKeyCode();
    String Component=getFactory().getDisplayName();
    if (!GateKeyboardModifier.TookKeyboardStrokes(KeybEvent,null,attrs,canvas,null,false))     if (AutoLabler.LabelKeyboardHandler(KeybEvent,getAttributeSet(),Component,null,getFactory(),canvas.getCircuit(),null,false)) {
      canvas.repaint();
    }
 else switch (KeybEvent) {
case KeyEvent.VK_UP:
      setFacing(canvas,Direction.NORTH);
    break;
case KeyEvent.VK_DOWN:
  setFacing(canvas,Direction.SOUTH);
break;
case KeyEvent.VK_LEFT:
setFacing(canvas,Direction.WEST);
break;
case KeyEvent.VK_RIGHT:
setFacing(canvas,Direction.EAST);
break;
case KeyEvent.VK_R:
Direction current=getFacing();
if (current == Direction.NORTH) setFacing(canvas,Direction.EAST);
 else if (current == Direction.EAST) setFacing(canvas,Direction.SOUTH);
 else if (current == Direction.SOUTH) setFacing(canvas,Direction.WEST);
 else setFacing(canvas,Direction.NORTH);
break;
case KeyEvent.VK_ESCAPE:
Project proj=canvas.getProject();
Library base=proj.getLogisimFile().getLibrary("String_Node_Str");
Tool next=(base == null) ? null : base.getTool("String_Node_Str");
if (next != null) {
proj.setTool(next);
Action act=SelectionActions.dropAll(canvas.getSelection());
if (act != null) {
proj.doAction(act);
}
}
break;
case KeyEvent.VK_BACK_SPACE:
if (lastAddition != null && canvas.getProject().getLastAction() == lastAddition) {
canvas.getProject().undoAction();
lastAddition=null;
}
}
}
}