summaryrefslogtreecommitdiff
path: root/indra/llwindow/llopenglview-objc.mm
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-03-04 18:01:05 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2024-03-04 18:01:05 +0200
commitb68a05e7c30930976ed1273b4c7a0fec01d2a84f (patch)
tree03ababecc49376c0e607b3548d9beb596f79c3a7 /indra/llwindow/llopenglview-objc.mm
parentd47c6536820d1ed6e373147678dd0fab90e80ab8 (diff)
parent701d1a33bb8227aa55a71f48caeb30a453e77ee0 (diff)
Merge branch 'main' into marchcat/x-merge
# Conflicts: # indra/llcommon/llstring.cpp # indra/llcommon/llstring.h
Diffstat (limited to 'indra/llwindow/llopenglview-objc.mm')
-rw-r--r--indra/llwindow/llopenglview-objc.mm59
1 files changed, 44 insertions, 15 deletions
diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm
index 586e00b5e4..0bd4e506a2 100644
--- a/indra/llwindow/llopenglview-objc.mm
+++ b/indra/llwindow/llopenglview-objc.mm
@@ -733,23 +733,52 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (void)insertText:(id)aString replacementRange:(NSRange)replacementRange
{
- if (!mHasMarkedText)
+ // SL-19801 Special workaround for system emoji picker
+ if ([aString length] == 2)
{
- for (NSInteger i = 0; i < [aString length]; i++)
- {
- callUnicodeCallback([aString characterAtIndex:i], mModifiers);
- }
- } else {
- resetPreedit();
- // We may never get this point since unmarkText may be called before insertText ever gets called once we submit our text.
- // But just in case...
-
- for (NSInteger i = 0; i < [aString length]; i++)
- {
- handleUnicodeCharacter([aString characterAtIndex:i]);
- }
- mHasMarkedText = FALSE;
+ @try
+ {
+ uint32_t b0 = [aString characterAtIndex:0];
+ uint32_t b1 = [aString characterAtIndex:1];
+ if (((b0 & 0xF000) == 0xD000) && ((b1 & 0xF000) == 0xD000))
+ {
+ uint32_t b = 0x10000 | ((b0 & 0x3F) << 10) | (b1 & 0x3FF);
+ callUnicodeCallback(b, 0);
+ return;
+ }
+ }
+ @catch(NSException * e)
+ {
+ // One of the characters is an attribute string?
+ NSLog(@"Encountered an unsupported attributed character. Exception: %@ String: %@", e.name, aString);
+ return;
+ }
}
+
+ @try
+ {
+ if (!mHasMarkedText)
+ {
+ for (NSInteger i = 0; i < [aString length]; i++)
+ {
+ callUnicodeCallback([aString characterAtIndex:i], mModifiers);
+ }
+ } else {
+ resetPreedit();
+ // We may never get this point since unmarkText may be called before insertText ever gets called once we submit our text.
+ // But just in case...
+
+ for (NSInteger i = 0; i < [aString length]; i++)
+ {
+ handleUnicodeCharacter([aString characterAtIndex:i]);
+ }
+ mHasMarkedText = FALSE;
+ }
+ }
+ @catch(NSException * e)
+ {
+ NSLog(@"Failed to process an attributed string. Exception: %@ String: %@", e.name, aString);
+ }
}
- (void) insertNewline:(id)sender