aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quick/items/qquicktextnodeengine.cpp10
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected.qml13
2 files changed, 18 insertions, 5 deletions
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp
index 5140ccb68f..efe79b382e 100644
--- a/src/quick/items/qquicktextnodeengine.cpp
+++ b/src/quick/items/qquicktextnodeengine.cpp
@@ -821,14 +821,14 @@ void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode,
for (int i = 0; i < node->ranges.size(); ++i) {
const QPair<int, int> &range = node->ranges.at(i);
- int rangeLength = range.second - range.first + 1;
+ int rangeLength = range.second - range.first;
if (previousNode != 0) {
for (int j = 0; j < previousNode->ranges.size(); ++j) {
const QPair<int, int> &otherRange = previousNode->ranges.at(j);
- if (range.first <= otherRange.second && range.second >= otherRange.first) {
+ if (range.first < otherRange.second && range.second > otherRange.first) {
int start = qMax(range.first, otherRange.first);
int end = qMin(range.second, otherRange.second);
- rangeLength -= end - start + 1;
+ rangeLength -= end - start;
if (rangeLength == 0)
break;
}
@@ -839,10 +839,10 @@ void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode,
for (int j = 0; j < nextNode->ranges.size(); ++j) {
const QPair<int, int> &otherRange = nextNode->ranges.at(j);
- if (range.first <= otherRange.second && range.second >= otherRange.first) {
+ if (range.first < otherRange.second && range.second > otherRange.first) {
int start = qMax(range.first, otherRange.first);
int end = qMin(range.second, otherRange.second);
- rangeLength -= end - start + 1;
+ rangeLength -= end - start;
if (rangeLength == 0)
break;
}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected.qml
new file mode 100644
index 0000000000..849e4b8597
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+ TextEdit {
+ id: textEdit
+ text: "и в у"
+ anchors.centerIn: parent
+ Component.onCompleted: textEdit.select(2, 3)
+ font.pixelSize: 14
+ }
+}