diff --git a/src/musikbox/Main.cpp b/src/musikbox/Main.cpp index b9527f4cd..7a896669e 100644 --- a/src/musikbox/Main.cpp +++ b/src/musikbox/Main.cpp @@ -226,17 +226,34 @@ int main(int argc, char* argv[]) int64 next = -1; /* used in escape sequences */ -#ifndef WIN32 - /* convert +ESC to M- sequences */ - if (kn == "^[") { - next = getch(); - if (next != -1) { - kn = std::string("M-") + std::string(keyname((int) next)); - } + /* convert +ESC to M- sequences */ + if (kn == "^[") { + next = getch(); + if (next != -1) { + 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 << "keyname: " << kn << std::endl; // std::cerr << "ch: " << ch << std::endl; if (ch == '\t') { /* tab */ diff --git a/src/musikbox/app/window/CommandWindow.cpp b/src/musikbox/app/window/CommandWindow.cpp index 3318a663d..81fbb74b9 100755 --- a/src/musikbox/app/window/CommandWindow.cpp +++ b/src/musikbox/app/window/CommandWindow.cpp @@ -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; }