editor: Fix relative line numbers breaking with nested folds (#47035)

Closes #46516

The previous fix only worked for non-nested folds, whereas this one also
considers nested folds properly. Also makes this more straightforward to
read.

Release Notes:

- Fixed an issue where relative line numbering would break with nested
folds.
10a536b328Finn Evers committed on 1/16/2026, 11:56:51 PM· committed by GitHubparentafaccf9
1 file changedLine totals unavailable