internal static UnsafeNativeMethods.ITfCompositionView GetCurrentCompositionView(UnsafeNativeMethods.ITfDocumentMgr documentMgr)
 {
     UnsafeNativeMethods.ITfContext tfContext;
     documentMgr.GetBase(out tfContext);
     UnsafeNativeMethods.ITfCompositionView composition = FrameworkTextComposition.GetComposition(tfContext);
     Marshal.ReleaseComObject(tfContext);
     return(composition);
 }
 internal static void CompleteCurrentComposition(UnsafeNativeMethods.ITfDocumentMgr documentMgr)
 {
     UnsafeNativeMethods.ITfContext tfContext;
     documentMgr.GetBase(out tfContext);
     UnsafeNativeMethods.ITfCompositionView composition = FrameworkTextComposition.GetComposition(tfContext);
     if (composition != null)
     {
         UnsafeNativeMethods.ITfContextOwnerCompositionServices tfContextOwnerCompositionServices = tfContext as UnsafeNativeMethods.ITfContextOwnerCompositionServices;
         tfContextOwnerCompositionServices.TerminateComposition(composition);
         Marshal.ReleaseComObject(composition);
     }
     Marshal.ReleaseComObject(tfContext);
 }