Text can only be selected near the left hand edge right after initial creation
Ubuntu Studio 14.04, GIT commit: a2a87a9
I suspect this will turn out to be system specific and hard to reproduce, but:
1) new score, flute, 32 bars
2) click full measure rest in bar 1
3) Ctrl+T
4) type a whole lot of characters - say, until the text is at least 6 measures long
5) Esc to exit edit mode
6) Esc again to deselect text
7) try to select the text by clicking near the end (or anywhere over bars 2-6)
Result: you can't select the text (bad)
8) try again but this time click somewhere over bar 1
Result: text selects (good)
Now, try the following:
9) add line break after measure 4
10) try to select text by clicking near the very end of the text
Result: it works (good)
11) delete the line break
12) try to select the text by clicking near the very end again (or anywhere over bars 2-6)
Result: it works (good)
I've been noticing this for some time now - weeks? months? since I moved to Linux? Hard to say. But it's mystifying to me.
Comments
Got it! Once I realized that actually, the text becomes easy to select the moment you do anything that forces a layout, it became obvious. Turns out the cause is simple: doLayout() is only called right when a text item is first created (and is still empty) and not again when you are done typing. So as far as the Page knows, the text is zero-length. It's lucky you can select it at all! Here's where it fails:
https://github.com/musescore/MuseScore/blob/a2a87a90c874f9eaaee4faf047f…
The "obvious" fix is to make sure doLayout() gets called after editing text. It's done anyhow for chord symbols. Here's a PR:
https://github.com/musescore/MuseScore/pull/1100
I suppose it's possible we could get by without a full doLayout(), but this seems the easy/safe fix, and it shouldn't impact performance since it's only on endEdit().
Fixed in b1d6a0665a
Automatically closed -- issue fixed for 2 weeks with no activity.