linenoise-swift icon indicating copy to clipboard operation
linenoise-swift copied to clipboard

Add UTF-8 support

Open pcbeard opened this issue 1 year ago • 0 comments

This is my attempt to add support for UTF-8 input. This generalizes the reading and writing of characters and strings, using the Character type instead of representing characters as UInt8.

I've tested it on Arch Linux primarily, over SSH and directly using a KDE terminal application. All the unit tests pass, and terminal display and editing seem to work. It's possible with more work to simplify the buffer indexing, since it's now using an internal buffer of [Character] as the intermediate representation. This would allow using Int for character indexing, instead of having to use buffer.startIndex, .endIndex. However, I've left that unchanged for now, as that would be needed when using array slices.

pcbeard avatar Jan 20 '23 11:01 pcbeard