OK, started looking at the SynEdit part. Great start, but needs some work. (and I need some feedback on some parts)
1) I applied and checked on the 4.n branch => but new patches should be a against Lazarus main branch please. (or a cloned git with a feature branch forked of current main)
2) COMMENTS
- Some are too verbose e.g. inside TCustomSynEdit.WMImeQueryCaretPos => that comment states the obvious. Please don't.
- Comment in front of procedure WMImeQueryCaretPos and procedure WMImeSetPreedit: To verbose / wrong place.
=> that the msg can also be sent to other-than-SynEdit => obvious: therefore to verbose
=> what QT expects: either on the dispatching end, or inside the QT dedicated class (but not here, in theory others WS can dispatch this msg too)
Not yet reviewed comments in other files => please adjust according to the above. Thanks
Also, why not place those 2 new methods, with the other existing message handlers?
(if they are indeed needed / see below)
3)
How does LM_IM_QUERY_CARET_POS differ from IMR_QUERYCHARPOSITION ?
- Yes its the current caret, for which you need to know at which char (in the pre-edit text) the caret is.
- Why "R^.Right := R^.Left + 2;" ? What if the caret is in insert mode, then it is way wider.
What is the exact spec in QT => what does QT sent, and where is the documentation for that?4)
Where does LM_IM_SET_PREEDIT differ from GCS_COMPSTR ?
5)
No, don't. NO!The received text is not to be "just painted over the edit".
It should be inserted into the actual text (other text in the edit should move, when the pre-text changes).
See procedure LazSynImeFull.WMImeComposition(var Msg: TMessage);
It uses a selection object to insert the text (with a special undo reason ecImeStr).
But you might also use SetTextBetweenPoints, however you must keep track of the text you inserted, so you can revert this (including reverting undo info).
For coloring you can create pairs of TSynEditMarkupSelection and TSynEditSelection. Or other markup objects including your own subclasses if that is needed.