OK, turned off softwrap, so that is not the issue. I should have said that the issue is with "wrap line length".
I have attached 2 more screenshots that illustrate the original problem that I encountered but tried to simplify with my first example. The 2 screenshots have soft wrap on and off.
In both cases, notice that the "echo" on line 5 is color coded green when it should be yellow instead as it is on line 3.
This is because for line 4 in the comment, there is an opening single quote after the first "aaaaaa". But the close quote happens to be on the 2nd line 4. Because the color coding is not continued across wrapped lines, SE thinks the single quote on line 4 is an opening quote, therefore all code that follows on line 5, and anything else below it which I have not included, will be wrongly colored green. This is messing up the display of a real script that I have.