This question already has an answer here:
- How to say regrets [I should not have X] 2 answers
The following sentence was translated in the following ways:
I shouldn't have slept with the window open.
I regret (that) I was sleeping with the window open.
But why does
～んじゃなかった make the meaning "I shouldn't have slept" rather than "I hadn't been sleeping"?