What you describe here is already default behavior--'f' will always target the robot and not a square.
However, auto-targeting only happens in keyboard mode, so I'm assuming you're using the mouse? Mouse mode doesn't auto-target because it would complicate the behavior somewhat (different targeting behavior depending on direct clicking vs. pressing 'f'), and if the auto-target robot happens to be in an unexpected place because you weren't firing for a while, it can force you to pick up your mouse and move it to compensate for the distance.
Currently in mouse mode when you press 'f' it shouldn't even move the cursor at all (I don't see it doing that), just activate firing mode wherever the cursor is currently (which if you just fired at a robot, will be the last position at which you did so, hence what you're seeing).
That said, I believe the UI should probably be changed to distinguish an 'f' used to activate the firing mode, even while using the mouse, and allow it to target based on the preference set in the options (only when the "Auto Cursor" option is active).