Is there a name for the error when you press a shortcut to close a tab, only to realize you were in the wrong window?

Related, how do you call when you type something, but the cursor is in a window other than you thought?

I need a feature called "where did I just type, and please remove it again"!

@asperamanca The number of compilation errors caused by spurious shell commands at random places in source code is not high, but it's more than 0.

@rollbear Well, those the compiler actually finds for you.
Think about an email that you send off wthout noticing:

Dear Sirs!

About my room reservation, would it be possible to have a git restore . king size bed instead of queen?

Thank you!