Lots of work on unicode support

This commit is contained in:
2023-05-19 00:23:23 -04:00
parent a25213d259
commit 7e25be10a4
10 changed files with 249 additions and 228 deletions

View File

@@ -219,18 +219,18 @@ static int socket_poll(struct pollfd *pollvec, int pollcount, int mstimeout, std
}
// Write unicode onto the console.
static void console_write(const CodepointString &cps) {
std::string utf8 = ReadlineDevice::to_utf8(cps);
static void console_write(const std::u32string &cps) {
std::string utf8 = drvutil::to_utf8(cps);
write(1, utf8.c_str(), utf8.size());
}
static CodepointString console_read() {
CodepointString result;
static std::u32string console_read() {
std::u32string result;
char buffer[512];
int nread = read(0, buffer, 512);
if (nread > 0) {
std::string_view s(buffer, nread);
result = ReadlineDevice::from_utf8(s, nullptr);
result = drvutil::from_utf8(s, nullptr);
}
return result;
}