summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-08-10 14:46:49 +0200
committerLars Knoll <lars.knoll@qt.io>2018-08-17 08:23:20 +0000
commit1702ae24b3a35e370f0766d392f7bb273ddbd032 (patch)
tree4a948c43a82ace5c73b70cc3b6e153ccddaadf9c
parent70ba75519d66243b6fef6d452e9e158f7d3ea438 (diff)
Only show the bidi cursor mark if we actually have bidirectional text
Don't show the mark simply because we have unicode code points larger than 0x590. Task-number: QTBUG-69665 Change-Id: I9af97383f3bcd52277a5288e7ad06ec240c7e51c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
-rw-r--r--src/gui/text/qtextengine.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 6751c077ac..5094ed9f52 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1037,19 +1037,31 @@ struct QBidiAlgorithm {
}
}
- bool process()
+ bool checkForBidi() const
{
- memset(analysis, 0, length * sizeof(QScriptAnalysis));
-
- bool hasBidi = (baseLevel != 0);
- if (!hasBidi) {
- for (int i = 0; i < length; ++i) {
- if (text[i].unicode() >= 0x590) {
- hasBidi = true;
+ if (baseLevel != 0)
+ return true;
+ for (int i = 0; i < length; ++i) {
+ if (text[i].unicode() >= 0x590) {
+ switch (text[i].direction()) {
+ case QChar::DirR: case QChar::DirAN:
+ case QChar::DirLRE: case QChar::DirLRO: case QChar::DirAL:
+ case QChar::DirRLE: case QChar::DirRLO: case QChar::DirPDF:
+ case QChar::DirLRI: case QChar::DirRLI: case QChar::DirFSI: case QChar::DirPDI:
+ return true;
+ default:
break;
}
}
}
+ return false;
+ }
+
+ bool process()
+ {
+ memset(analysis, 0, length * sizeof(QScriptAnalysis));
+
+ bool hasBidi = checkForBidi();
if (!hasBidi)
return false;