That pesky terminating composition

If you’re developing a text service for Windows XP, you’ve likely found that your composition gets terminated unexpectedly whenever you have more than one character.  On English, you can avoid terminating your composition by making sure that every character in the composition has the GUID_PROP_COMPOSING property associated with it, by making sure that you call ITfComposition::ShiftStart and/or ITfComposition::ShiftEnd appropriately.

However, with some languages, even this will not prevent your compositions from being terminated.

I had a chat with the TSF developers, and they said:

This was sort of by design on XP to terminate non-EA compositions by default. The design changed in Vista, but the change wasn’t ported to XP because it went as a new feature, not as a bug fix.

The good news is that there’s a workaround for XP: your text service needs to add\set this value in the registry:

HKCU\SOFTWARE\Microsoft\CTF\CUAS\NonEAComposition=2

(2 means ‘enable’, all others or no entry – non-EA compositions will be disabled).

Hopefully others will find this useful.