Important: The information in this document is obsolete and should not be used for new development.
TESetWordBreak
TheTESetWordBreakprocedure installs the address of a customized word-selection break routine in thewordBreakfield of the specified edit record.
PROCEDURE TESetWordBreak (wBrkProc: ProcPtr; hTE: TEHandle);
wBrkProc- A pointer to the customized word-selection break routine.
hTE- A handle to the edit record containing the
wordBreakfield to
be modified.DESCRIPTION
A word break routine determines which word is highlighted when the user double-clicks in the text. It also determines where TextEdit breaks the text at the end of a line. You can useTESetWordBreakto replace the default routine in thewordBreakfield that is used for word selection and line breaking under certain circumstances. Whether or not TextEdit uses the word-selection break routine referenced by this field is determined by the algorithm implemented in the defaultTEFindWordroutine. For a description of this algorithm, see "Customizing Word Selection" on page 2-56; this section also describes what to consider if you replace theTEFindWordhook routine.When you replace the
wordBreakfield hook routine, your customized word break routine is used instead of the default one. The default routine breaks words at any character with an ASCII value of $20 or less (the space character or nonprinting control characters). Your routine can use a different value.Before non-Roman script systems were supported, TextEdit used the word break hook routine installed in the
wordBreakfield for all word selection and line breaking. However, in order to support both Roman and non-Roman script systems, TextEdit now uses the routine installed in the low-memory global variableTEFindWord. The defaultTEFindWordhook routine determines which hook TextEdit should use for word selection and line breaking--thewordBreakhook or the Text UtilitiesFindWordBreaksprocedure--based on what script systems are installed and some other factors. You can replace theTEFindWordhook routine with a customized version.ASSEMBLY-LANGUAGE INFORMATION
You must directly set thewordBreakfield to point to your own word break routine; do not use theTESetWordBreakprocedure.The registers for the word break routine must contain the following values.
Registers on entry A0 Pointer to text D0 Character position (word)
Register on exit Z bit (zero flag) Condition code: status register 0 to break at specified character 1 not to break there
If you replace
TEFindWord, be careful to set the correct values in the appropriate registers. ForTEFindWord, the registers are set on entry as specified below, and TextEdit depends on the registers being set at exit as specified below.
Registers on entry D0 Current position (the value of selStartfield in edit record) (word)D2 Identifier of routine that called FindWordBreaks (word)Identifier Value Explanation teWordSelect 4 called for word selection teWordDrag 8 called for extending word selection teFromFind 12 called for determining new line breaks teFromRecal 16 called for word breaking in line recalculation A3 Pointer to the edit record A4 Locked handle to the edit record
Registers on exit D0 Word start (word) D1 Word end (word) SEE ALSO
For more information about theFindWordBreaksprocedure, see the chapter "Text Utilities" in this book.