(SendTextView) Check for important keys in each received byte
This commit is contained in:
parent
c24c3187ad
commit
bcb92de53c
|
@ -1,4 +1,3 @@
|
|||
#include <iostream>
|
||||
/*
|
||||
* Copyright 2021, Jaidyn Levesque <jadedctrl@teknik.io>
|
||||
* All rights reserved. Distributed under the terms of the MIT license.
|
||||
|
@ -38,22 +37,27 @@ SendTextView::KeyDown(const char* bytes, int32 numBytes)
|
|||
fCurrentIndex = 0;
|
||||
fCurrentWord.SetTo("");
|
||||
|
||||
if ((bytes[0] == B_UP_ARROW) && (modifiers == 0)) {
|
||||
for (int i = 0; i < numBytes; i++) {
|
||||
if ((bytes[i] == B_UP_ARROW) && (modifiers == 0)) {
|
||||
_UpHistory();
|
||||
return;
|
||||
}
|
||||
else if ((bytes[0] == B_DOWN_ARROW) && (modifiers == 0)) {
|
||||
else if ((bytes[i] == B_DOWN_ARROW) && (modifiers == 0)) {
|
||||
_DownHistory();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((bytes[0] == B_ENTER) && (modifiers & B_COMMAND_KEY))
|
||||
if ((bytes[i] == B_ENTER)
|
||||
&& ((modifiers & B_COMMAND_KEY) || (modifiers & B_SHIFT_KEY))) {
|
||||
Insert("\n");
|
||||
else if ((bytes[0] == B_ENTER) && (modifiers == 0)) {
|
||||
return;
|
||||
}
|
||||
else if (bytes[i] == B_ENTER) {
|
||||
_AppendHistory();
|
||||
fChatView->MessageReceived(new BMessage(APP_CHAT));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
BTextView::KeyDown(bytes, numBytes);
|
||||
}
|
||||
|
||||
|
|
Ŝarĝante…
Reference in New Issue