mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-01 00:19:20 +00:00
Fixed UTF8 input in Main.cpp parse loop. More substantial key handling refactors coming soon.
This commit is contained in:
parent
5514b0f726
commit
1ac9b18af9
@ -226,7 +226,6 @@ int main(int argc, char* argv[])
|
||||
|
||||
int64 next = -1; /* used in escape sequences */
|
||||
|
||||
#ifndef WIN32
|
||||
/* convert +ESC to M- sequences */
|
||||
if (kn == "^[") {
|
||||
next = getch();
|
||||
@ -234,7 +233,25 @@ int main(int argc, char* argv[])
|
||||
kn = std::string("M-") + std::string(keyname((int) next));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* multi-byte UTF8 character */
|
||||
else if (ch >= 194 && ch <= 223) {
|
||||
kn = "";
|
||||
kn += (char) ch;
|
||||
kn += (char) getch();
|
||||
}
|
||||
else if (ch >= 224 && ch <= 239) {
|
||||
kn = "";
|
||||
kn += (char) ch;
|
||||
kn += (char) getch();
|
||||
kn += (char) getch();
|
||||
}
|
||||
else if (ch >= 240 && ch <= 244) {
|
||||
kn = "";
|
||||
kn += (char) ch;
|
||||
kn += (char) getch();
|
||||
kn += (char) getch();
|
||||
kn += (char) getch();
|
||||
}
|
||||
|
||||
//std::cerr << "keyname: " << kn << std::endl;
|
||||
// std::cerr << "ch: " << ch << std::endl;
|
||||
|
@ -72,8 +72,6 @@ void CommandWindow::WriteChar(int64 ch) {
|
||||
return;
|
||||
}
|
||||
|
||||
waddch(this->GetContent(), ch);
|
||||
|
||||
if (ch == '\b' || ch == 127) { /* backspace */
|
||||
wdelch(this->GetContent());
|
||||
|
||||
@ -97,6 +95,7 @@ void CommandWindow::WriteChar(int64 ch) {
|
||||
this->bufferPosition = 0;
|
||||
}
|
||||
else {
|
||||
waddch(this->GetContent(), ch);
|
||||
this->buffer[bufferPosition++] = (char) ch;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user