Overeating at night


I’m finding my thoughts are creating my reality, and I want to break this pattern. Here is my current model:
C: I ate popcorn/nuts/chips/chocolate
T: See? I’ll never be able to lose weight!
F: Defeated.
A: Multiple overeats this week
R: Gain Weight

How do I break out of this pattern?