* 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);
|
_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.
|
// Terminal filters RET, ENTER, F1...F12, and ARROW key code.
|
||||||
if (numBytes == 1) {
|
|
||||||
const char *toWrite = NULL;
|
const char *toWrite = NULL;
|
||||||
|
int32 toWriteLen = -1;
|
||||||
|
|
||||||
switch (*bytes) {
|
switch (*bytes) {
|
||||||
case B_RETURN:
|
case B_RETURN:
|
||||||
if (rawChar == B_RETURN)
|
if (rawChar == B_RETURN)
|
||||||
@@ -1270,27 +1287,15 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
toWrite = bytes;
|
||||||
|
toWriteLen = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toWrite) {
|
if (toWrite) {
|
||||||
_ScrollTo(0, true);
|
_ScrollTo(0, true);
|
||||||
fShell->Write(toWrite, strlen(toWrite));
|
fShell->Write(toWrite, toWriteLen < 0 ? strlen(toWrite) : toWriteLen);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
} 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