Skip to content

Commit 5664481

Browse files
committed
fix(tsf): use ITfContext::GetSelection to get cursor position
avoid any insertion which could active document focus fix #193, #194
1 parent 2f3b283 commit 5664481

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

WeaselTSF/Composition.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,13 @@ STDAPI CGetTextExtentEditSession::DoEditSession(TfEditCookie ec)
153153
ITfRange *pRangeComposition = NULL;
154154
RECT rc;
155155
BOOL fClipped;
156-
if ((_pContext->QueryInterface(IID_ITfInsertAtSelection, (LPVOID *) &pInsertAtSelection)) != S_OK)
156+
TF_SELECTION selection;
157+
ULONG nSelection;
158+
if (FAILED(_pContext->QueryInterface(IID_ITfInsertAtSelection, (LPVOID *) &pInsertAtSelection)))
157159
goto Exit;
158-
if ((pInsertAtSelection->InsertTextAtSelection(ec, TF_IAS_QUERYONLY, NULL, 0, &pRangeComposition)) != S_OK)
160+
if (FAILED(_pContext->GetSelection(ec, TF_DEFAULT_SELECTION, 1, &selection, &nSelection)))
159161
goto Exit;
160-
161-
if ((_pContextView->GetTextExt(ec, pRangeComposition, &rc, &fClipped)) == S_OK && (rc.left != 0 || rc.top != 0))
162+
if ((_pContextView->GetTextExt(ec, selection.range, &rc, &fClipped)) == S_OK && (rc.left != 0 || rc.top != 0))
162163
_pTextService->_SetCompositionPosition(rc);
163164

164165
Exit:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy