Fix #6107 : bar lines and brackets disappearing when some of the staff they span is hidden

Fixed by analyzing brackets and bar line spans rather than only relying on start and stop staff Y offset (which is not set if the staff is not shown).

Note: there are still issues with measure numbers, but these belong more to system items than to bar lining.
Add test