r26509 broke char codes (e.g. Ctrl-K and Ctrl-D) matching one of the

checked B_* char codes. Fixes bug #2533.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26550 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-07-21 22:14:25 +00:00
parent a86d99e0da
commit 5b1d60c80e
+15 -11
View File
@@ -1172,7 +1172,6 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
// Terminal filters RET, ENTER, F1...F12, and ARROW key code. // Terminal filters RET, ENTER, F1...F12, and ARROW key code.
const char *toWrite = NULL; const char *toWrite = NULL;
int32 toWriteLen = -1;
switch (*bytes) { switch (*bytes) {
case B_RETURN: case B_RETURN:
@@ -1197,6 +1196,7 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
BMessage message(MSG_PREVIOUS_TAB); BMessage message(MSG_PREVIOUS_TAB);
message.AddPointer("termView", this); message.AddPointer("termView", this);
Window()->PostMessage(&message); Window()->PostMessage(&message);
return;
} else if ((mod & B_CONTROL_KEY) || (mod & B_COMMAND_KEY)) { } else if ((mod & B_CONTROL_KEY) || (mod & B_COMMAND_KEY)) {
toWrite = CTRL_LEFT_ARROW_KEY_CODE; toWrite = CTRL_LEFT_ARROW_KEY_CODE;
} else } else
@@ -1210,6 +1210,7 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
BMessage message(MSG_NEXT_TAB); BMessage message(MSG_NEXT_TAB);
message.AddPointer("termView", this); message.AddPointer("termView", this);
Window()->PostMessage(&message); Window()->PostMessage(&message);
return;
} else if ((mod & B_CONTROL_KEY) || (mod & B_COMMAND_KEY)) { } else if ((mod & B_CONTROL_KEY) || (mod & B_COMMAND_KEY)) {
toWrite = CTRL_RIGHT_ARROW_KEY_CODE; toWrite = CTRL_RIGHT_ARROW_KEY_CODE;
} else } else
@@ -1273,7 +1274,6 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
_ScrollTo(fScrollOffset + fFontHeight * fTermRows, true); _ScrollTo(fScrollOffset + fFontHeight * fTermRows, true);
return; return;
} }
if (rawChar == B_PAGE_DOWN) if (rawChar == B_PAGE_DOWN)
toWrite = PAGE_DOWN_KEY_CODE; toWrite = PAGE_DOWN_KEY_CODE;
break; break;
@@ -1281,21 +1281,25 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
case B_FUNCTION_KEY: case B_FUNCTION_KEY:
for (int32 i = 0; i < 12; i++) { for (int32 i = 0; i < 12; i++) {
if (key == function_keycode_table[i]) { if (key == function_keycode_table[i]) {
fShell->Write(function_key_char_table[i], 5); toWrite = function_key_char_table[i];
return; break;
} }
} }
break; break;
default:
toWrite = bytes;
toWriteLen = 1;
break;
} }
if (toWrite) { // If the above code proposed an alternative string to write, we get it's
_ScrollTo(0, true); // length. Otherwise we write exactly the bytes passed to this method.
fShell->Write(toWrite, toWriteLen < 0 ? strlen(toWrite) : toWriteLen); size_t toWriteLen;
if (toWrite != NULL) {
toWriteLen = strlen(toWrite);
} else {
toWrite = bytes;
toWriteLen = numBytes;
} }
_ScrollTo(0, true);
fShell->Write(toWrite, toWriteLen);
} }