When middle-button pasting or clipboard pasting, the pasted data arrives all at once. This unfortunately violated our nice assumption that you could read off 1-4 bytes that were ready on stdin as a single character. Making pasting work requires giving this up and teaching screen_read to find character boundaries. This is imprecise (e.g. ← followed by 'a' will be incorrectly returned as the single character 0x61445b1b that the UI will fail to recognise and will ignore), but the cases where it fails seem unlikely to cause practical problems.
Now that we are forced into including logic for finding character boundaries, it may be a good idea to unify this with the --script handling. That also has its own logic for finding character boundaries that does not understand UTF-8.
Github: fixes #173 “middle click paste doesn't work in the UI”
When middle-button pasting or clipboard pasting, the pasted data arrives all at once. This unfortunately violated our nice assumption that you could read off 1-4 bytes that were ready on stdin as a single character. Making pasting work requires giving this up and teaching
screen_read
to find character boundaries. This is imprecise (e.g. ← followed by 'a' will be incorrectly returned as the single character 0x61445b1b that the UI will fail to recognise and will ignore), but the cases where it fails seem unlikely to cause practical problems.Now that we are forced into including logic for finding character boundaries, it may be a good idea to unify this with the
--script
handling. That also has its own logic for finding character boundaries that does not understand UTF-8.Github: fixes #173 “middle click paste doesn't work in the UI”