Need help and support please

My partner has BPD and we have been together for a year. She has her own place but often stays with me (sometimes for weeks at a time). Last December, we got into a big fight which resulted in her screaming at me and throwing a bunch of stuff all over the house. The argument was started when I forgot to clean out the litter box because I had a friend visiting for a few days and I got preoccupied. I’m not perfect and screamed back at her because I was completely fed up. I called her crazy among other things and she left the house to “cool off” and grab dinner. 
I was so upset and anxious by her behavior that I decided to drink so I could hopefully be asleep before she got home. Unfortunately she got home as I was drinking and was furious. She asked me if I drink because of her, and called me every name in the book. She began crying, screaming, and throwing more things. She lunged at me and threw a book at me, which I deflected. I never put a hand on her. The neighbors had heard all the fighting and screaming and called the police who burst into the house with guns drawn. She was hysterically crying on the couch by this point and I was dragged out. She told the police I didn’t do anything but regardless I got arrested and charged. They saw the house in disarray, had several neighbors say they heard her screaming, and I was drunk. It didn’t look good for me. I have an ongoing case.

Following this ordeal, she had been nice to me and loving (there is only a limited restraining order due to her denying any wrongdoing). I, however, know this isn’t going to last. Unfortunately, when I tried to break it off with her because she is unstable, she called me hundreds of times and threatened to “make my court case a big deal” and that she would tell everyone that I am an abuser etc. My lawyer and I have weighed the options and it seems I am basically being forced by my idiotic state to stay with her. Basically I need to stay on her good side for a while (until 2022). 

Please help me as I feel trapped and scared for my future!