For some reason, when I place the cursor on line 3, it behaves as though it were on the line above, so line 2. Editing text on line 3 edits text on line 2. The solution is to unfold all, and then fold all text. Then the cursor will behave correctly.
The problem is inconsistent, but the solution is consistent.