Unicode tricks to represent kakoune selections in discussions

Talking about kakoune selections on this forum or in Github issues is often awkward.
Asciicast videos or screenshots are the best solutions to convey what we mean because if we rely only on textual representation, we have to explain the convention used in the snippet beforehand.

Example of an hypothetic conversation:

“What happen if I press <foo> and the my selection looks like this (where the cursor is on the r)”:

%(bar) rest of the text

So I thought, maybe there are unicode codepoints that represent letter characters but with special styling. It turns out there are quite a few solutions https://yaytext.com/square-text/

The previous example could be wrote like:

🄱🄰🆁 rest of the text

Here the boxy letters represent the selection and the black one the cursor.

To differentiate between main and secondary selections:

ⓢⓔⓒⓞⓝⓓⓐⓡⓨ ⓢⓔⓛⓔⓒⓣⓘⓞ🅝 and 🄿🅁🄸🄼🄰🅁🅈 🅂🄴🄻🄴🄲🅃🄸🄾🅽

Unfortunately, there seems no way to put some chars like ( or [ in those boxes or bubbles.

1 Like

I like the method used in parinfer’s tests: https://github.com/shaunlebron/parinfer/blob/master/lib/test/cases/smart-mode.md

A line is inserted in between the literal lines with markup, and this is machine parseable.

These could be something like:

bar rest of text


secondary selection and PRIMARY SELECTION
------------------+     ----------------^

If using unicode, you’ll want a combining character, not a different character range. You could use this and its complement for selections: http://www.fileformat.info/info/unicode/char/20d7/index.htm

Here’s a good one for indicating a cursor: https://www.fileformat.info/info/unicode/char/20e6/index.htm