Module: util/allocateHats/getTokenComparator
Namespaces
Functions
getTokenComparator
▸ getTokenComparator(selectionDisplayLine, selectionCharacterIndex): (a: TokenWithDisplayLine, b: TokenWithDisplayLine) => number
Gets a comparison function that can be used to sort tokens based on their distance from the current cursor in terms of display lines.
Parameters
| Name | Type | Description |
|---|---|---|
selectionDisplayLine | number | The display line of the cursor location |
selectionCharacterIndex | number | The character index of current cursor within line |
Returns
fn
▸ (a, b): number
Gets a comparison function that can be used to sort tokens based on their distance from the current cursor in terms of display lines.
Parameters
| Name | Type |
|---|---|
a | TokenWithDisplayLine |
b | TokenWithDisplayLine |
Returns
number