The current logic does not correctly restrict the current_match counter when there are zero matches and the keyboard shortcuts are used. This can result in misbehaviours as shown below.
current_match