The behaviour comes from the use of HYPHEN-MINUS U+002D whose primary usage in document processing applications is to indicate a hyphen. Application is free to cause line wrap after the hyphen, as if a long word had been hyphenated.
When you really mean a minus sign with its mathematical semantics, you should use MINUS SIGN U+2212 which is specifically reserved for its numeric meaning. Usually the shape of the glyph is slightly different from the hyphen (wider than the latter) so that you can visually notice the difference.
If you are reluctant to enter a character not commonly present on keyboards, you can also enter a ZERO WIDTH JOINER U+200D after the minus-hyphen with
No-width No Space.
To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!
In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.