Fix disappearing selection spanning different scripts
Due to the way itemization is currently done in Qt,
Cyrillic text (and other writing systems) separated by
spaces will become separate items because the spaces
are itemized as Script_Common. In the Scenegraph's text
node engine, we should merge these items into a single node
as long as the same font is used for all the text. But
a bug in the engine caused this to fail when the text
was selected. The symptom of this was that in some rare
cases one of the items would vanish if it were in the
middle of a selection.
In order to support the bearing of selected text leaning outside
the selection rect, I previously added a hack which would add
all selected text as unselected text as well in
b0783c21fb54b939f07ddf5658cc51113b8014e6. This was an awkward
way of doing it and caused said regression. A less intrusive way
is just to add the text to the scene graph twice, as this does not
interfere with the logic needed to support selecting part of
ligatures nor the engine's ability to merge nodes correctly.
[ChangeLog][Text] Fixed regression with selections spanning
different scripts.
Task-number: QTBUG-46829
Change-Id: I0faed76fb2cd1ac0b2e5cc54b81008b5e2550733
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>