public void OnUpdateComposition(ITfCompositionView view, ITfRange rangeNew) { var range = view.Range; var rangeacp = range.QueryInterface <ITfRangeACP>(); rangeacp.GetExtent(out _compositionStart, out _compositionLength); rangeacp.Dispose(); range.Dispose(); _compViews.Add(view); }
public override HRESULT DoEditSession([In] uint ec) { // get the head of the doc ITfRange pRangeStart = pContext.GetStart(ec); // do the work ToggleCase(ec, pRangeStart, true); return(HRESULT.S_OK); }
private void InsertTextAtSelection(uint ec, ITfContext pContext, string pchText, int cchText) { // we need a special interface to insert text at the selection var pInsertAtSelection = (ITfInsertAtSelection)pContext; // insert the text ITfRange pRange = pInsertAtSelection.InsertTextAtSelection(ec, 0, pchText, cchText); // update the selection, we'll make it an insertion point just past the inserted text. pRange.Collapse(ec, TfAnchor.TF_ANCHOR_END); var tfSelection = new TF_SELECTION[] { new TF_SELECTION { range = pRange, style = new TF_SELECTIONSTYLE { ase = TfActiveSelEnd.TF_AE_NONE, fInterimChar = false } } }; pContext.SetSelection(ec, 1, tfSelection); }