Mouse-Down Regions
As noted in the preceding section, a single caret position can correspond to two
character offsets. However, a mouse-down event occurs either to the left or
the right of a caret position. (Consistent with QuickDraw, a screen position is an infinitely thin line; hence, a mouse-down event cannot occur exactly on a
caret position.) The region between the caret position and the middle of an
adjacent character maps unambiguously to a single character offset. This
region is called a mouse-down region.
The following shows how TextEdit determines mouse-down regions and in so doing decides which character offset the mouse-down event belongs to. In the
figure, direction boundaries (that is, the borders between left-to-right and
right-to-left text) are denoted by solid vertical lines and occur at primary
caret positions 12 and 4. (These caret positions are also secondary caret
positions 4 and 12, respectively.)
In the figure, character offset boundaries (the boundaries of mouse-down
regions) are shown by dotted lines. The shaded regions indicate where a
mouse-down region does not span a primary caret position. For example, if a
mouse click occurs to the left of the direction boundary at primary caret
position 12, the mouse-down region is defined as within the leading edge of
character 12. However, if a mouse click occurs to the right of primary caret
position 12, the mouse-down region is defined as within the leading edge of
character 4.
Mouse-down region specifics