Important: The information in this document is obsolete and should not be used for new development.
TESetWordBreak
TheTESetWordBreak
procedure installs the address of a customized word-selection break routine in thewordBreak
field 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
wordBreak
field 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 useTESetWordBreak
to replace the default routine in thewordBreak
field 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 defaultTEFindWord
routine. For a description of this algorithm, see "Customizing Word Selection" on page 2-56; this section also describes what to consider if you replace theTEFindWord
hook routine.When you replace the
wordBreak
field 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
wordBreak
field 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 defaultTEFindWord
hook routine determines which hook TextEdit should use for word selection and line breaking--thewordBreak
hook or the Text UtilitiesFindWordBreaks
procedure--based on what script systems are installed and some other factors. You can replace theTEFindWord
hook routine with a customized version.ASSEMBLY-LANGUAGE INFORMATION
You must directly set thewordBreak
field to point to your own word break routine; do not use theTESetWordBreak
procedure.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 selStart
field in edit record) (word)D2 Identifier of routine that called FindWord
Breaks (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 theFindWordBreaks
procedure, see the chapter "Text Utilities" in this book.