From 7403cbdb59752c25892ec792d64b2e6c6a70f282 Mon Sep 17 00:00:00 2001 From: "tague%netscape.com" Date: Wed, 14 Jul 1999 20:08:02 +0000 Subject: [PATCH] Fixed bug #6898 unable to move cursor within IME composition string. git-svn-id: svn://10.0.0.236/trunk@39360 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/windows/nsWindow.cpp | 37 +++++++++++++++++++------ mozilla/widget/src/windows/nsWindow.h | 1 + 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/mozilla/widget/src/windows/nsWindow.cpp b/mozilla/widget/src/windows/nsWindow.cpp index 37a217b8849..94f9f0c6c5c 100644 --- a/mozilla/widget/src/windows/nsWindow.cpp +++ b/mozilla/widget/src/windows/nsWindow.cpp @@ -2758,6 +2758,9 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT mIMECompClauseStringLength = 0; } + if (lParam & GCS_CURSORPOS) { + mIMECursorPosition = ::ImmGetCompositionString(hIMEContext,GCS_CURSORPOS,NULL,0); + } // // This provides us with a composition string // @@ -3527,17 +3530,24 @@ nsWindow::MapDBCSAtrributeArrayToUnicodeOffsets(PRUint32* textRangeListLengthRes // figure out the ranges from the compclause string // if (mIMECompClauseStringLength==0) { - *textRangeListLengthResult = 1; - *textRangeListResult = new nsTextRange[1]; + *textRangeListLengthResult = 2; + *textRangeListResult = new nsTextRange[2]; (*textRangeListResult)[0].mStartOffset=0; substringLength = ::MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,mIMECompositionString, mIMECompositionStringLength,NULL,0); - (*textRangeListResult)[0].mEndOffset = substringLength-1; + (*textRangeListResult)[0].mEndOffset = substringLength; (*textRangeListResult)[0].mRangeType = mIMEAttributeString[0]; + substringLength = ::MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,mIMECompositionString, + mIMECursorPosition,NULL,0); + (*textRangeListResult)[0].mStartOffset=substringLength; + (*textRangeListResult)[0].mEndOffset = substringLength; + (*textRangeListResult)[0].mRangeType = NS_TEXTRANGE_CARETPOSITION; + + } else { - *textRangeListLengthResult = 0; - for(i=0;i<(PRUint32)mIMECompClauseStringLength;i++) { + *textRangeListLengthResult = 1; + for(i=0;i