$Feedback =>
TRUSTED {
Call TEditMouseImpl.ResolveToChar to get Tioga location
rightOfLine:
BOOLEAN ← TEditMouseImpl.ResolveToChar[
indexSelection,
indexHandle.indexViewer,
NARROW[indexHandle.indexViewer.data, TEditDocument.TEditDocumentData],
mouse.mouseX,
mouse.mouseY];
selection info returned in indexSelection.start.pos as TextNode.Location
back up the tree from indexSelection.start.pos.node accumulating phrases
ix: IndexEntry ← NEW[IndexEntryRec];
item: OrderedSymbolTableRef.Item;
smallerItem, equalItem, largerItem: OrderedSymbolTableRef.Item;
phrases: LIST OF ROPE ← NIL;
node: TextNode.Ref ← indexSelection.start.pos.node;
WHILE node #
NIL
AND node # indexHandle.rootIndexBranch
DO
nodeRope: ROPE ← TiogaOps.GetRope[node];
phrase: ROPE ← Rope.Substr[nodeRope, 0, Rope.Index[nodeRope, 0, ","]];
IF phrase = NIL OR phrase.Length = 0 THEN EXIT;
phrases ← CONS[phrase, phrases];
node ← TiogaOps.Parent[node];
ENDLOOP;
lookup the phrases for next larger or equal
ix.phrases ← phrases;
[smallerItem, equalItem, largerItem] ← OrderedSymbolTableRef.Lookup3[indexHandle.indexTable, ix];
use item as the ix item for feedback
item ← IF equalItem # NIL THEN equalItem ELSE IF largerItem # NIL THEN largerItem ELSE smallerItem;
Make selection node reverse video
ix ← NARROW[item, IndexEntry];
TiogaOps.SetSelection[
viewer: indexHandle.indexViewer,
start: [ix.branchLocationStart.node, ix.branchLocationStart.where],
end: [ix.branchLocationEnd.node, ix.branchLocationEnd.where],
level: word,
caretBefore: TRUE,
pendingDelete: TRUE,
which: feedback];
};