From 27680729acd44e890a7f12853debc377384d8bbf Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Tue, 24 Jul 2012 10:58:49 -0400 Subject: Bug 385570 - [DBCS4.2] wrong selection by using a mouse toward a character of Unicode surrogate pair at end of line --- .../Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java index 0619c69f1b..3816b1273a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java @@ -2268,14 +2268,14 @@ public int getOffset (int x, int y, int[] trailing) { int offset = run.start + piCP[0]; int length = segmentsText.length(); char ch = offset < length ? segmentsText.charAt(offset) : 0; - if (0xD800 <= ch && ch <= 0xDBFF) { + if (0xD800 <= ch && ch <= 0xDBFF && piTrailing[0] <= 1) { if (offset + 1 < length) { ch = segmentsText.charAt(offset + 1); if (0xDC00 <= ch && ch <= 0xDFFF) { if (trailing != null) trailing[0] = 0; } } - } else if (0xDC00 <= ch && ch <= 0xDFFF) { + } else if (0xDC00 <= ch && ch <= 0xDFFF && piTrailing[0] <= 1) { if (offset - 1 >= 0) { ch = segmentsText.charAt(offset - 1); if (0xD800 <= ch && ch <= 0xDBFF) { -- cgit