* TermView::KeyDown(): We were writing to the TTY even when the user
pressed a shortcut that should result in a terminal action (e.g. Shift-Left/Right -- Shift-Left generated a Ctrl-\). * Removed spaces at the end of lines. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26509 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1154,9 +1154,26 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
|
||||
|
||||
_ActivateCursor(true);
|
||||
|
||||
// handle multi-byte chars
|
||||
if (numBytes > 1) {
|
||||
if (fEncoding != M_UTF8) {
|
||||
char destBuffer[16];
|
||||
int cnum = CodeConv::ConvertFromInternal(bytes, numBytes,
|
||||
(char *)destBuffer, fEncoding);
|
||||
_ScrollTo(0, true);
|
||||
fShell->Write(destBuffer, cnum);
|
||||
return;
|
||||
}
|
||||
|
||||
_ScrollTo(0, true);
|
||||
fShell->Write(bytes, numBytes);
|
||||
return;
|
||||
}
|
||||
|
||||
// Terminal filters RET, ENTER, F1...F12, and ARROW key code.
|
||||
if (numBytes == 1) {
|
||||
const char *toWrite = NULL;
|
||||
int32 toWriteLen = -1;
|
||||
|
||||
switch (*bytes) {
|
||||
case B_RETURN:
|
||||
if (rawChar == B_RETURN)
|
||||
@@ -1270,27 +1287,15 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
toWrite = bytes;
|
||||
toWriteLen = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (toWrite) {
|
||||
_ScrollTo(0, true);
|
||||
fShell->Write(toWrite, strlen(toWrite));
|
||||
return;
|
||||
fShell->Write(toWrite, toWriteLen < 0 ? strlen(toWrite) : toWriteLen);
|
||||
}
|
||||
} else {
|
||||
// input multibyte character
|
||||
if (fEncoding != M_UTF8) {
|
||||
char destBuffer[16];
|
||||
int cnum = CodeConv::ConvertFromInternal(bytes, numBytes,
|
||||
(char *)destBuffer, fEncoding);
|
||||
_ScrollTo(0, true);
|
||||
fShell->Write(destBuffer, cnum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_ScrollTo(0, true);
|
||||
fShell->Write(bytes, numBytes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user