summaryrefslogtreecommitdiffstats
path: root/src/kernel/qrichtext_p.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2025-01-30 23:40:14 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2025-02-13 22:39:51 +0900
commit67cb0f6762768ee0d32adef1d7307ff7bb985407 (patch)
tree9c391724f3eae5ba2b8279ea9de6245a1f44d25b /src/kernel/qrichtext_p.cpp
parentfd79f0c8b020ff0c60b62c83745beb030ef38997 (diff)
downloadtqt-67cb0f6762768ee0d32adef1d7307ff7bb985407.tar.gz
tqt-67cb0f6762768ee0d32adef1d7307ff7bb985407.zip
Fix editing of text containing surrogate characters.
This relates to issue #162. Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit 9c648bea9bfb1113c070a05b36f78ff006d0877a)
Diffstat (limited to 'src/kernel/qrichtext_p.cpp')
-rw-r--r--src/kernel/qrichtext_p.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/kernel/qrichtext_p.cpp b/src/kernel/qrichtext_p.cpp
index 022eb13de..5a6eca7cf 100644
--- a/src/kernel/qrichtext_p.cpp
+++ b/src/kernel/qrichtext_p.cpp
@@ -114,15 +114,15 @@ int TQTextCursor::x() const
return 0;
TQTextStringChar *c = para->at( idx );
int curx = c->x;
- if ( !c->rightToLeft &&
- c->c.isSpace() &&
- idx > 0 &&
- para->at( idx - 1 )->c != '\t' &&
- !c->lineStart &&
- ( para->alignment() & TQt::AlignJustify ) == TQt::AlignJustify )
+ if ( !c->rightToLeft && c->c.isSpace() && idx > 0 && para->at( idx - 1 )->c != '\t' &&
+ !c->lineStart && ( para->alignment() & TQt::AlignJustify ) == TQt::AlignJustify )
+ {
curx = para->at( idx - 1 )->x + para->string()->width( idx - 1 );
+ }
if ( c->rightToLeft )
+ {
curx += para->string()->width( idx );
+ }
return curx;
}