By default pressing Alt+. or calling Abort[] within the evaluation causes abort of the currently evaluating input. But when working in the
Alexey, please try this version of your code and tell me if/when it fails:
AbortAllPendingInputs :=
AbortProtect[
$new$PreRead = True;
$TimeOfAbort = SessionTime[];
last$PreRead = $PreRead;
$PreRead =
If[
TrueQ[SessionTime[] - $TimeOfAbort < 1],
"",
$new$PreRead = False; $PreRead = last$PreRead; $PreRead[#]
] &;
] /; ! TrueQ[$new$PreRead]