An application can use a word-break procedure to determine how to break words and lines. This information is used in word-wrap operations or when the user moves to the previous word or the next word by pressing the Ctrl-Left arrow or the Ctrl-Right arrow key combination. An application can send a message to a rich edit control to replace the default word-break procedure (EM_SETWORDBREAKPROC), to retrieve word-break information (EM_FINDWORDBREAK), or to determine on what line a given character falls (EM_EXLINEFROMCHAR).
A word-break procedure for a rich edit control groups characters into classes, identifying each class by a value in the range 0x00 through 0x0F. Word breaks can occur after delimiters or between characters of different classes. A character's class can be combined with zero or more word-break flags to form an 8-bit value. When performing word-wrap operations, a rich edit control uses word-break flags to determine where it can break lines. The following flags are supported:
WBF_BREAKAFTER | Lines can break after the character. This value allows wrapping after a character that does not mark the end of a word, such as a hyphen. |
WBF_BREAKLINE | The character is a delimiter, which marks the end of a word. Lines can break after delimiters. |
WBF_ISWHITE | The character is a white-space character. Trailing white-space characters are not included in the length of a line when wrapping. |