Smattr / clink

a modern re-implementation of Cscope
The Unlicense
41 stars 2 forks source link

anticipate more than 1 ready character on stdin #176

Closed Smattr closed 1 year ago

Smattr commented 1 year ago

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”