Skip to main content

Module completing

Module completing 

Source
Expand description

Handlers for the emoji offered while one is being written: a colon and the start of its short code, typed in the composer.

After everything that is done to the text, what is on the cursor’s line before the cursor is looked at (see emoji::typed_code). If it ends in a colon and COMPLETED_FROM letters or more of a short code, the emoji that may be are offered under the text, the likeliest first (see emoji::completing), and the keys that would move through the text move through them instead: the arrows up and down, Enter or Tab to take the one marked, Escape to put them away. The one taken stands where the colon and the letters were, with a space after it. Moving the cursor away, or typing what no short code has, puts them away as well.

A short code typed whole, with the colon that closes it, is its emoji at once: :tada: is what is written wherever emoji are written this way, by those who know the name and need no list.

flowchart TD
    edit["Something is done to the text"] --> closed{"A colon was typed that closes a short code?"}
    closed -->|"yes, and it is one"| swap["The emoji stands in its place"]
    closed -->|"no"| typed{"The line ends, at the cursor, in a colon and two letters or more?"}
    typed -->|"yes, and emoji are called that"| offer["They are offered under the text"]
    typed -->|"no"| away["Nothing is offered"]
    offer -->|"Enter, Tab, a click"| swap
    offer -->|"Esc"| away

Functions§

before_cursor 🔒
What is on the cursor’s line of content before the cursor, where nothing is selected: with something selected, what is typed takes its place, and completes nothing.
completed 🔒
What comes of the text of content being as it is now, for the emoji that are written by their short codes: the emoji to offer for the one being typed, if one is, ranked by the ones used. And if closed, which is whether the last thing done was typing a colon, and that colon closed a short code, the emoji is put in its place.
replace_before_cursor 🔒
Put with in content in place of the bytes bytes before the cursor, which are on its line.