There's a lot that can go into determining when to buy a different car instead of continuing to fix your current car. I'll cover some of the things I've looked at when making that decision myself.
I consider a vehicle to be an investment. If you don't continually keep up with maintenance (putting in more money and effort), then it'll be a bad investment. If you treat it right, it'll more than pay for itself over the years.
1. Can I afford car payments?
This is #1 for a reason. If you can't afford a reasonable down payment plus $150 or more a month for the payments, plus a sizable increase in your insurance, plus an increase in your yearly registration fees, you can't buy a new car.
To be able to make this easier, it's been recommended to me by others to start paying yourself a car payment's worth every single month (to a savings account essentially) to get used to the idea of paying a car payment as well as sacking it away for the down payment. This is money you don't spend until you need that down payment.
Maybe you only need to buy a different car for $4000 to get a better car. It might not be a Bentley, but it'll still get you where you need to be. Maybe you can get a $10k used car. Maybe you can get a tiny new car for $16k that'll be under warranty for 3-5 years.
If you spend that down payment on the car, do you still have emergency money for others things that might come up? If you have kids, do you still have the money to cover the co-payment on a broken arm? Do you have enough to cover your fridge dying without having to put it on a credit card?
Also, don't rely on a wage increase until you already have it. I've talked with people, or read their stories, where they spend their raise before they got it. Sometimes they spent the raise they never actually got. It almost always ends up in disaster. Not that you said anything about a raise, but I've covering all the bases here.
2. How much are my current repairs costing me?
If your current repairs are costing you significantly less than payments on a different car, keep doing the repairs. Unless you are doing the repairs yourself and spending all your free time on repairs (like I've done previously), it's probably not worth buying a different car.
3. Are your current repairs worse than the unknown repairs of a different car?
Even if you get a different car, there's a high likelihood that it'll be used and it'll need repairs as well. Older cars without extensive electronics are less expensive and easier to repair than newer cars that have a computer sprawling everywhere. Also, newer cars tend to wedge the motor in between all the gadgets, making for little room to do repairs under the hood.
4. Is your current car causing your stress, headaches, constantly breaking down, or otherwise causing you major problems?
If not, see #1-3. If it is, or you just hate the car, it's probably time for a change. If you absolutely love the car, but it's giving you fits (of rage), it might still be time for a change.
A different car can have it's own stress. A new payment/loan, higher insurance premiums, wanting to keep it "new", etc. What stresses are you willing to get of and what stresses are you willing to take on?
5. What does your mechanic say?
I once took my car in for a minor engine problem, which the mechanic said he could fix for $40. Unfortunately, he also said that the steel holding the rear wheels on was completely rusted out and warned me about going too fast or stopping to suddenly, saying that could rip off my wheels.
If you car has become dangerous to drive, it's time. If the repairs are extensive (like a full transmission rebuild, floor boards are see-though, repairs are continually over $1000, etc.), it's also time for a new ride.
6. How does it look?
Yes, this is superficial, but there's a lot that can go into it. Having a nasty looking car can affect your self confidence, self worth, how you are perceived by new people/significant others, how your boss looks at you, and more. This can possibly be fixed by a new paint job, but is it really worth it?
A paint job usually entails stripping off the old paint, which often ends up uncovering all kinds of problems you didn't know about. Massive rust, panel damage, and more are common when doing this kind of work. And even a cheap paint job isn't cheap.
I had an old car that I'd fixed a lot of rust spots on it. I didn't always have the right color of paint to match the existing color. Other times, I didn't even bother going beyond primer. I ended up calling it "mostly red", with the reds not even matching. I ended up taking a bunch of spray paint and making it all one color. It wasn't great, but it was better.
7. How many miles are on the car?
Some people ditch a car when it gets 75-100,000 miles. Some people think that same car is just finally "comfortably broke-in". Regardless, once you are over 150k miles, you're going to be seeing many more repairs. Over 200k miles, and the car is likely ready to retire. There are people who will disagree and have gone a lot farther with cars, but they have also done a lot of work to keep those cars running that long. Are you willing to pay for or do that many repairs?
8. What is your gas mileage?
If you are looking at single digits for gas mileage, you probably need something a lot better. Unless it's a truck that hauls things constantly, you should be getting at least 20 mpg even with an older car. With really low gas mileage, you are paying more for your current car than you realize. Newer cars tend to get over 30 mpg, and some up to 40 or 50 mpg.
9. Does it do what you need it to do and can you find a replacement that will also fit your needs?
If you can't find a replacement, not to mention be able to afford that replacement, then you're kind of stuck with what you have. More than likely, you just need to keep looking to be able to find that vehicle that can carry 10 people and be under $X000, pull a 3 ton trailer, or whatever your needs are.
10. Can you afford all the taxes, title, extended warranty, etc. that might be added to the "new" car purchase?
Buying a car is more than just the price on the window. The last time I bought a different car, I bought the extended warranty. The car was at the right mileage for needing a bunch of work, even though it was in good condition when I got it, so I decided to take the chance. It paid off. The car needed more repairs than the warranty cost, so I made out pretty well. The warranty I bought was $2000 and the repairs were around $3000, so I made it work for me. It doesn't always work like that, which is why insurance companies exist.
Taxes can be a major part of the purchase, as well as the title. These are usually dependent on the age and weight of the vehicle. The newer and larger the vehicle, the more taxes and the title will be. Remember to factor this into your car buying budget.
Conclusion
The value of a car is more than just it's financial worth. Vehicles cost time as well as money. Bad vehicles cause stress and anxiety, and that alone can be worth getting something different.
There are a lot more things to consider when looking at replacing vs. repairing a vehicle. I've tried to give you things to think about besides just financials, but money is a big factor. Especially if you don't have enough of it. Are you leaving enough money in your budget for the car payments and still have enough for rent, food, etc? Are your financial safety margins too small?
I rarely make a decision based purely on financials. When I see people do that, there are 2 ways they usually end up. Either they don't have anything (including money), or they have everything (including debt). In practice, somewhere in between if the right place to be and that "right place" is different for everyone.
In the end, it has to feel right. Just because it seems like a financial win on paper, it might not be if you just don't feel right about it.