musescore/MuseScore — pull request #1239 by MarcSabatella (2014-08-29 21:29:59+00:00)
Title: fix #31471: system text edits not linked

I was perhaps overly thorough in commenting this code, mostly for review purposes. But this *is* a rather odd set of things going on here, so it does deserve some documentation permanently. Perhaps edited down from what I have now.

BTW, the test for oldText.isEmpty() solves a bug that's been around for quite a while (since 1.3 at least) - add a note to a score, select it, ctrl+t, type text, esc. If you hit undo once, that removes the text. Hit it again and you'd expect your note to be removed, but nothing apparently happens. That's because the first undo() actually only undoes the *editing* of the text but leaves you with an empty staff text element.