From 42bc4ba02abebced9fc3e7f91317ae293cbd20dd Mon Sep 17 00:00:00 2001
From: Steven Bennetts <steve@lindenlab.com>
Date: Thu, 28 Feb 2008 01:12:38 +0000
Subject: merge Branch_1-19-0-Viewer -r 80279 : 80947 -> release

---
 indra/llwindow/llwindowmacosx.cpp | 18 +++++++++++-------
 indra/llwindow/llwindowwin32.cpp  | 13 +++++++++++--
 2 files changed, 22 insertions(+), 9 deletions(-)

(limited to 'indra/llwindow')

diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 5184a6caec..a1d97429e1 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -2102,15 +2102,17 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
 						}
 
 						// Handle preedit string.
-						if (preedit_string.length() > 0)
+						if (preedit_string.length() == 0)
 						{
-							if (preedit_segment_lengths.size() == 0)
-							{
-								preedit_segment_lengths.push_back(preedit_string.length());
-								preedit_standouts.push_back(FALSE);
-							}
-							mPreeditor->updatePreedit(preedit_string, preedit_segment_lengths, preedit_standouts, caret_position);
+							preedit_segment_lengths.clear();
+							preedit_standouts.clear();
+						}
+						else if (preedit_segment_lengths.size() == 0)
+						{
+							preedit_segment_lengths.push_back(preedit_string.length());
+							preedit_standouts.push_back(FALSE);
 						}
+						mPreeditor->updatePreedit(preedit_string, preedit_segment_lengths, preedit_standouts, caret_position);
 
 						result = noErr;
 					}
@@ -3366,6 +3368,8 @@ void LLWindowMacOSX::interruptLanguageTextInput()
 	{
 		FixTSMDocument(mTSMDocument);
 	}
+	// Don't we need to call resetPreedit here?
+	// Well, if Apple's TSM document is correct, we don't.
 }
 
 #endif // LL_DARWIN
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 0bba56f74f..a5367aac8a 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -3716,6 +3716,10 @@ void LLWindowWin32::interruptLanguageTextInput()
 			LLWinImm::notifyIME(himc, NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
 			LLWinImm::releaseContext(mWindowHandle, himc);
 		}
+
+		// Win32 document says there will be no composition string
+		// after NI_COMPOSITIONSTR returns.  The following call to
+		// resetPreedit should be a NOP unless IME goes mad...
 		mPreeditor->resetPreedit();
 	}
 }
@@ -3859,7 +3863,12 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes)
 			}
 		}
 
-		if (preedit_string.length() > 0)
+		if (preedit_string.length() == 0)
+ 		{
+			preedit_segment_lengths.clear();
+			preedit_standouts.clear();
+		}
+		else
 		{
 			if (preedit_segment_lengths.size() == 0)
 			{
@@ -3869,8 +3878,8 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes)
 			{
 				preedit_standouts.assign(preedit_segment_lengths.size(), FALSE);
 			}
-			mPreeditor->updatePreedit(preedit_string, preedit_segment_lengths, preedit_standouts, caret_position);
 		}
+		mPreeditor->updatePreedit(preedit_string, preedit_segment_lengths, preedit_standouts, caret_position);
 
 		// Some IME doesn't query char position after WM_IME_COMPOSITION,
 		// so we need to update them actively.
-- 
cgit v1.2.3