RICHEDIT once again

Rob Shearman rob at
Sun Jan 30 12:54:48 CST 2005

Krzysztof Foltman wrote:

> Mike McCormack wrote:
>> It might be better to use libwineunicode and kernel32 unicode string
>>  manipulation functions rather than msvcrt ones. eg lstrlenW,
>> lstrcpyW, etc. instead of wcslen, wcscpy, etc. Avoid the TCHAR type
>> in Wine code.
> Good point. I guess it would be nice to replace malloc/free with
> LocalAlloc/LocalFree, right ?

No, the LocalAlloc/LocalFree/GlobalAlloc/GlobalFree functions are relics 
from the old days of Win16. You should use HeapAlloc/HeapFree.

>> haven't).  We can merge the parser into the riched20 code quite 
>> easily... it's just  enters the text into the existing control using
>>  EM_SETSEL and some formatting messages.
> LOL :) That's a smart idea :) I'm curious about interactions with undo,
> but we have no undo anyway (yet).

Undo should be pretty easy as long as you can represent easily represent 
user actions in a transactions stack.
A user doing something will then cause an action to be pushed onto the 
stack (although you would probably want some coalescing so that you 
don't have to undo each character you typed, you can just undo a 
sentence). The undo command will pop a transaction of the stack and 
apply the inverse.
I've written a fairly nice implementation of this before in Java and it 
didn't take me very long.

The code looks good. It looks like you have the basic actions nailed. 
However, there are a few superfluous typecasts. In particular, please 
remove the ALLOC_OBJ macro because the name seems to suggest it does 
more than it actually does. You may want to use the existing 
doubly-linked list implementation at include/wine/list.h as it has been 
well-tested and people are familiar with the API. This is just a 
suggestion and you may feel that it is easier to use your own. A few 
more comments wouldn't go amiss either.

What is the ParaStyle structure used for? How does this relate to the 
Style structure? Each character can have a different style, so why is 
there a paragraph style?


More information about the wine-devel mailing list