fix stack vs heap issues by moving all coprocessor strings toward malloced arrays, reintroduce command caching. cut new potential gm release

This commit is contained in:
camh 2022-02-23 09:52:20 -08:00
parent fbc7e3a1ec
commit bf120297be
7 changed files with 96 additions and 69 deletions

View File

@ -1,4 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
#include <Serial.h>
#include <math.h>
#include <Devices.h>
@ -15,10 +16,9 @@ IOParam incomingSerialPortReference;
#define MAX_ATTEMPTS 10
#define RECEIVE_WINDOW_SIZE 32767 // receive in up to 32kb chunks
#define MAX_RECEIVE_SIZE 32767 // matching RECEIVE_WINDOW_SIZE for now
char GlobalSerialInputBuffer[MAX_RECEIVE_SIZE];
char tempOutput[MAX_RECEIVE_SIZE];
char application_id[255];
char *GlobalSerialInputBuffer;
char *tempOutput;
char *application_id;
int call_counter = 0;
// from: https://stackoverflow.com/questions/29847915/implementing-strtok-whose-delimiter-has-more-than-one-character
@ -142,7 +142,7 @@ void setupSerialPort(const char *name) {
return;
}
err = MacOpenDriver(serialPortInputName, &serialPortInput); // result in 0 but still doesn't work
err = MacOpenDriver(serialPortInputName, &serialPortInput);
#ifdef PRINT_ERRORS
@ -398,6 +398,10 @@ void setupCoprocessor(char *applicationId, const char *serialDeviceName) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: setupCoprocessor");
#endif
GlobalSerialInputBuffer = malloc(sizeof(char) * MAX_RECEIVE_SIZE);
tempOutput = malloc(sizeof(char) * MAX_RECEIVE_SIZE);
application_id = malloc(sizeof(char) * 255);
strcpy(application_id, applicationId);
@ -667,7 +671,7 @@ void callFunctionOnCoprocessor(char* functionName, char* parameters, char* outpu
getReturnValueFromResponse(serialPortResponse, "FUNCTION", output);
#ifdef DEBUGGING
writeSerialPortDebug(boutRefNum, "Greturn value from response");
writeSerialPortDebug(boutRefNum, "Got return value from response");
writeSerialPortDebug(boutRefNum, output);
#endif

Binary file not shown.

Binary file not shown.

View File

@ -95,7 +95,6 @@ void PROFILE_COMPLETE() {
#include "Quickdraw.h"
#include "output_js.h"
#include "coprocessorjs.h"
#include "nuklear_app.c"
/* GMac is used to hold the result of a SysEnvirons call. This makes

View File

@ -17111,14 +17111,14 @@ nk_do_edit(nk_flags *state, struct nk_command_buffer *out,
cursor.y -= edit->scrollbar.y;
nk_fill_rect(out, cursor, 0, cursor_color, true);
#ifdef COMMAND_CACHING
struct nk_rect whiteTextarea2;
whiteTextarea2.x = cursor.x + cursor.w;
whiteTextarea2.y = cursor.y - 2;
whiteTextarea2.h = cursor.h + 6;
whiteTextarea2.w = 9; //cursor.w * 2; // this was previously used when cursor.w = 4, doesn't work well at = 1
nk_fill_rect(out, whiteTextarea2, 0, qd.black, false);
#endif
// #ifdef COMMAND_CACHING
// struct nk_rect whiteTextarea2;
// whiteTextarea2.x = cursor.x + cursor.w;
// whiteTextarea2.y = cursor.y - 2;
// whiteTextarea2.h = cursor.h + 6;
// whiteTextarea2.w = 9; //cursor.w * 2; // this was previously used when cursor.w = 4, doesn't work well at = 1
// nk_fill_rect(out, whiteTextarea2, 0, qd.black, false);
// #endif
} else {
/* draw cursor inside text */
// short glyph_len;
@ -17139,8 +17139,11 @@ nk_do_edit(nk_flags *state, struct nk_command_buffer *out,
// txt.text = cursor_text_color;
nk_fill_rect(out, label, 0, cursor_color, true);
// TODO: if we want to fix the dangling cursor when typing in the middle of the text,
// we need to create a white box at the previous cursor location, and draw it there.
// this is a start towards that, but it will draw over the top of the text:
// struct nk_rect whiteTextarea2;
// whiteTextarea2.x = label.x + label.w;
// whiteTextarea2.x = label.x - label.w;
// whiteTextarea2.y = label.y - 2;
// whiteTextarea2.h = label.h + 6;
// whiteTextarea2.w = label.w;
@ -17172,14 +17175,14 @@ nk_do_edit(nk_flags *state, struct nk_command_buffer *out,
// background_color = whiteColor;
// else
// background_color = background;
#ifdef COMMAND_CACHING
struct nk_rect whiteTextarea;
whiteTextarea.x = area.x;
whiteTextarea.y = area.y;
whiteTextarea.h = area.h;
whiteTextarea.w = area.w;
nk_fill_rect(out, whiteTextarea, 0, qd.black, false);
#endif
// #ifdef COMMAND_CACHING
// struct nk_rect whiteTextarea;
// whiteTextarea.x = area.x;
// whiteTextarea.y = area.y;
// whiteTextarea.h = area.h;
// whiteTextarea.w = area.w;
// nk_fill_rect(out, whiteTextarea, 0, qd.black, false);
// #endif
nk_edit_draw_text(out, style, area.x - edit->scrollbar.x, area.y - edit->scrollbar.y, 0, begin, l, row_height, font, style->normal, style->text_normal, nk_false, true);
}

View File

@ -97,19 +97,20 @@ void aFailed(char *file, int line) {
#define MAX_CHAT_MESSAGES 17
#define MAX_RECEIVE_SIZE 32767 // this has a corresponding value in coprocessor.c
#define MAX_FRIENDLY_NAME_LENGTH 64
Boolean firstOrMouseMove = true;
Boolean gotMouseEvent = false;
char activeChat[64];
char activeChatMessages[MAX_CHAT_MESSAGES][2048]; // this should match to MAX_ROWS in index.js
char box_input_buffer[2048];
char chatFriendlyNames[16][64];
char ip_input_buffer[255];
char jsFunctionResponse[MAX_RECEIVE_SIZE];
char chatCountFunctionResponse[MAX_RECEIVE_SIZE];
char tempChatCountFunctionResponse[MAX_RECEIVE_SIZE];
char previousChatCountFunctionResponse[MAX_RECEIVE_SIZE];
char new_message_input_buffer[255];
char *activeChat;
char *activeChatMessages;
char *box_input_buffer;
char *chatFriendlyNames;
char *ip_input_buffer;
char *jsFunctionResponse;
char *chatCountFunctionResponse;
char *tempChatCountFunctionResponse;
char *previousChatCountFunctionResponse;
char *new_message_input_buffer;
int activeMessageCounter = 0;
int chatFriendlyNamesCounter = 0;
int coprocessorLoaded = 0;
@ -134,7 +135,6 @@ struct nk_context *ctx;
aFailed(__FILE__, __LINE__)
#include <Types.h>
#include "nuklear.h"
#include "nuklear_quickdraw.h"
#include "coprocessorjs.h"
@ -148,7 +148,7 @@ void getMessagesFromjsFunctionResponse() {
for (int i = 0; i < MAX_CHAT_MESSAGES; i++) {
memset(&activeChatMessages[i], '\0', 2048);
memset(&activeChatMessages[i * 2048], '\0', 2048);
}
activeMessageCounter = 0;
@ -158,7 +158,7 @@ void getMessagesFromjsFunctionResponse() {
// loop through the string to extract all other tokens
while (token != NULL) {
sprintf(activeChatMessages[activeMessageCounter], "%s", token);
sprintf(&activeChatMessages[activeMessageCounter * 2048], "%s", token);
token = (char *)strtokm(NULL, "ENDLASTMESSAGE");
activeMessageCounter++;
}
@ -176,7 +176,7 @@ void sendMessage() {
char output[2048];
sprintf(output, "%s&&&%.*s", activeChat, box_input_len, box_input_buffer);
memset(&box_input_buffer, '\0', 2048);
memset(box_input_buffer, '\0', 2048);
box_input_len = 0;
// this was an attempt to get the text in the textbox to go away... doesn't really work for a few more redraws
@ -207,7 +207,7 @@ void getChats() {
while (token != NULL) {
writeSerialPortDebug(boutRefNum, token);
sprintf(chatFriendlyNames[chatFriendlyNamesCounter++], "%s", token);
sprintf(&chatFriendlyNames[chatFriendlyNamesCounter++ * MAX_FRIENDLY_NAME_LENGTH], "%s", token);
token = (char *)strtokm(NULL, ",");
}
@ -354,10 +354,10 @@ void getChatCounts() {
for (int i = 0; i < chatFriendlyNamesCounter; i++) {
if (strstr(chatFriendlyNames[i], " new) ") != NULL) {
if (strstr(&chatFriendlyNames[i * MAX_FRIENDLY_NAME_LENGTH], " new) ") != NULL) {
char chatName[64];
sprintf(chatName, "%.63s", chatFriendlyNames[i]);
sprintf(chatName, "%.63s", &chatFriendlyNames[i * MAX_FRIENDLY_NAME_LENGTH]);
int updateResults = 0;
char *(*updatePieces[2])[64];
@ -391,14 +391,14 @@ void getChatCounts() {
if (count == 0 || !strcmp(activeChat, (char *)chatUpdate[0])) {
sprintf(chatFriendlyNames[i], "%.63s", (char *)chatUpdate[0]);
sprintf(&chatFriendlyNames[i * MAX_FRIENDLY_NAME_LENGTH], "%.63s", (char *)chatUpdate[0]);
} else {
sprintf(chatFriendlyNames[i], "(%d new) %.63s", count, (char *)chatUpdate[0]);
sprintf(&chatFriendlyNames[i * MAX_FRIENDLY_NAME_LENGTH], "(%d new) %.63s", count, (char *)chatUpdate[0]);
}
break;
}
} else if (prefix(chatFriendlyNames[i], (char *)chatUpdate[0])) {
} else if (prefix(&chatFriendlyNames[i * MAX_FRIENDLY_NAME_LENGTH], (char *)chatUpdate[0])) {
#ifdef MESSAGES_FOR_MACINTOSH_DEBUGGING
writeSerialPortDebug(boutRefNum, "match2");
@ -407,10 +407,10 @@ void getChatCounts() {
if (count == 0 || !strcmp(activeChat, (char *)chatUpdate[0])) {
sprintf(chatFriendlyNames[i], "%.63s", (char *)chatUpdate[0]);
sprintf(&chatFriendlyNames[i * MAX_FRIENDLY_NAME_LENGTH], "%.63s", (char *)chatUpdate[0]);
} else {
sprintf(chatFriendlyNames[i], "(%d new) %.63s", count, (char *)chatUpdate[0]);
sprintf(&chatFriendlyNames[i * MAX_FRIENDLY_NAME_LENGTH], "(%d new) %.63s", count, (char *)chatUpdate[0]);
}
break;
}
@ -563,7 +563,7 @@ static void nuklearApp(struct nk_context *ctx) {
for (int i = 0; i < MAX_CHAT_MESSAGES; i++) {
memset(&activeChatMessages[i], '\0', 2048);
memset(&activeChatMessages[i * 2048], '\0', 2048);
}
getMessages(activeChat, 0);
@ -600,12 +600,12 @@ static void nuklearApp(struct nk_context *ctx) {
nk_layout_row_push(ctx, 169);
if (nk_button_label(ctx, chatFriendlyNames[i])) {
if (nk_button_label(ctx, &chatFriendlyNames[i * MAX_FRIENDLY_NAME_LENGTH])) {
if (strstr(chatFriendlyNames[i], " new) ") != NULL) {
if (strstr(&chatFriendlyNames[i * MAX_FRIENDLY_NAME_LENGTH], " new) ") != NULL) {
char chatName[96];
sprintf(chatName, "%.63s", chatFriendlyNames[i]);
sprintf(chatName, "%.63s", &chatFriendlyNames[i * MAX_FRIENDLY_NAME_LENGTH]);
#ifdef MESSAGES_FOR_MACINTOSH_DEBUGGING
writeSerialPortDebug(boutRefNum, "clicked1 chatName");
@ -628,15 +628,15 @@ static void nuklearApp(struct nk_context *ctx) {
#endif
sprintf(activeChat, "%.63s", name);
sprintf(chatFriendlyNames[i], "%.63s", name);
sprintf(&chatFriendlyNames[i * MAX_FRIENDLY_NAME_LENGTH], "%.63s", name);
} else {
#ifdef MESSAGES_FOR_MACINTOSH_DEBUGGING
writeSerialPortDebug(boutRefNum, "clicked2 chatName");
writeSerialPortDebug(boutRefNum, chatFriendlyNames[i]);
writeSerialPortDebug(boutRefNum, chatFriendlyNames[i * MAX_FRIENDLY_NAME_LENGTH]);
#endif
sprintf(activeChat, "%.63s", chatFriendlyNames[i]);
sprintf(activeChat, "%.63s", &chatFriendlyNames[i * MAX_FRIENDLY_NAME_LENGTH]);
}
forceRedrawChats = 6; // redraw the chat list for several iterations in an attempt to get rid of the hovered button
@ -682,7 +682,7 @@ static void nuklearApp(struct nk_context *ctx) {
// writeSerialPortDebug(boutRefNum, "activeChatMessages[i]");
// writeSerialPortDebug(boutRefNum, activeChatMessages[i]);
nk_label(ctx, activeChatMessages[i], NK_TEXT_ALIGN_LEFT);
nk_label(ctx, &activeChatMessages[i * 2048], NK_TEXT_ALIGN_LEFT);
}
}
@ -727,9 +727,18 @@ struct nk_context* initializeNuklearApp() {
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: initializeNuklearApp");
#endif
activeChat = malloc(sizeof(char) * MAX_FRIENDLY_NAME_LENGTH);
activeChatMessages = malloc(sizeof(char) * (MAX_CHAT_MESSAGES * 2048)); // this should match to MAX_ROWS in index.js
box_input_buffer = malloc(sizeof(char) * 2048);
chatFriendlyNames = malloc(sizeof(char) * (16 * MAX_FRIENDLY_NAME_LENGTH));
ip_input_buffer = malloc(sizeof(char) * 255);
jsFunctionResponse = malloc(sizeof(char) * MAX_RECEIVE_SIZE);
chatCountFunctionResponse = malloc(sizeof(char) * MAX_RECEIVE_SIZE);
tempChatCountFunctionResponse = malloc(sizeof(char) * MAX_RECEIVE_SIZE);
previousChatCountFunctionResponse = malloc(sizeof(char) * MAX_RECEIVE_SIZE);
new_message_input_buffer = malloc(sizeof(char) * 255);
sprintf(activeChat, "no active chat");
memset(&chatCountFunctionResponse, '\0', MAX_RECEIVE_SIZE);
memset(&previousChatCountFunctionResponse, '\0', MAX_RECEIVE_SIZE);
graphql_input_window_size = nk_rect(WINDOW_WIDTH / 2 - 118, 80, 234, 100);
chats_window_size = nk_rect(0, 0, 180, WINDOW_HEIGHT);

View File

@ -23,9 +23,11 @@
#include <Scrap.h>
#include <Serial.h>
#include "SerialHelper.h"
#include <stdlib.h>
#define ENABLED_DOUBLE_BUFFERING
// #define COMMAND_CACHING
#define COMMAND_CACHING
#include "nuklear.h"
// #define NK_QUICKDRAW_GRAPHICS_DEBUGGING
// #define DRAW_BLIT_LOCATION
@ -556,7 +558,7 @@ void updateBounds(int top, int bottom, int left, int right) {
#ifdef COMMAND_CACHING
if (!forceRedraw && cmd->type == lastCmd->type && memcmp(r, lastCmd, sizeof(struct nk_command_rect)) == 0) {
if (!lastInputWasBackspace && cmd->type == lastCmd->type && memcmp(r, lastCmd, sizeof(struct nk_command_rect)) == 0) {
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
writeSerialPortDebug(boutRefNum, "ALREADY DREW CMD nk_command_rect");
@ -609,7 +611,7 @@ void updateBounds(int top, int bottom, int left, int right) {
}
#ifdef COMMAND_CACHING
if (!forceRedraw && cmd->type == lastCmd->type && memcmp(r, lastCmd, sizeof(struct nk_command_rect_filled)) == 0) {
if (!lastInputWasBackspace && cmd->type == lastCmd->type && memcmp(r, lastCmd, sizeof(struct nk_command_rect_filled)) == 0) {
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
writeSerialPortDebug(boutRefNum, "ALREADY DREW CMD nk_command_rect_filled");
@ -646,7 +648,7 @@ void updateBounds(int top, int bottom, int left, int right) {
const struct nk_command_text *t = (const struct nk_command_text*)cmd;
#ifdef COMMAND_CACHING
if (!forceRedraw && t->allowCache && cmd->type == lastCmd->type && memcmp(t, lastCmd, sizeof(struct nk_command_text)) == 0) {
if (!lastInputWasBackspace && t->allowCache && cmd->type == lastCmd->type && memcmp(t, lastCmd, sizeof(struct nk_command_text)) == 0) {
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
char log[255];
@ -700,7 +702,7 @@ void updateBounds(int top, int bottom, int left, int right) {
#ifdef COMMAND_CACHING
if (!forceRedraw && cmd->type == lastCmd->type && memcmp(l, lastCmd, sizeof(struct nk_command_line)) == 0) {
if (!lastInputWasBackspace && cmd->type == lastCmd->type && memcmp(l, lastCmd, sizeof(struct nk_command_line)) == 0) {
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
writeSerialPortDebug(boutRefNum, "ALREADY DREW CMD nk_command_line");
@ -728,7 +730,7 @@ void updateBounds(int top, int bottom, int left, int right) {
const struct nk_command_circle *c = (const struct nk_command_circle *)cmd;
#ifdef COMMAND_CACHING
if (!forceRedraw && cmd->type == lastCmd->type && memcmp(c, lastCmd, sizeof(struct nk_command_circle)) == 0) {
if (!lastInputWasBackspace && cmd->type == lastCmd->type && memcmp(c, lastCmd, sizeof(struct nk_command_circle)) == 0) {
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
writeSerialPortDebug(boutRefNum, "ALREADY DREW CMD nk_command_circle");
@ -763,7 +765,7 @@ void updateBounds(int top, int bottom, int left, int right) {
const struct nk_command_circle_filled *c = (const struct nk_command_circle_filled *)cmd;
#ifdef COMMAND_CACHING
if (!forceRedraw && cmd->type == lastCmd->type && memcmp(c, lastCmd, sizeof(struct nk_command_circle_filled)) == 0) {
if (!lastInputWasBackspace && cmd->type == lastCmd->type && memcmp(c, lastCmd, sizeof(struct nk_command_circle_filled)) == 0) {
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
writeSerialPortDebug(boutRefNum, "ALREADY DREW CMD nk_command_circle_filled");
@ -802,7 +804,7 @@ void updateBounds(int top, int bottom, int left, int right) {
const struct nk_command_triangle *t = (const struct nk_command_triangle*)cmd;
#ifdef COMMAND_CACHING
if (!forceRedraw && cmd->type == lastCmd->type && memcmp(t, lastCmd, sizeof(struct nk_command_triangle)) == 0) {
if (!lastInputWasBackspace && cmd->type == lastCmd->type && memcmp(t, lastCmd, sizeof(struct nk_command_triangle)) == 0) {
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
writeSerialPortDebug(boutRefNum, "ALREADY DREW CMD nk_command_triangle");
@ -832,7 +834,7 @@ void updateBounds(int top, int bottom, int left, int right) {
const struct nk_command_triangle_filled *t = (const struct nk_command_triangle_filled *)cmd;
#ifdef COMMAND_CACHING
if (!forceRedraw && cmd->type == lastCmd->type && memcmp(t, lastCmd, sizeof(struct nk_command_triangle_filled)) == 0) {
if (!lastInputWasBackspace && cmd->type == lastCmd->type && memcmp(t, lastCmd, sizeof(struct nk_command_triangle_filled)) == 0) {
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
writeSerialPortDebug(boutRefNum, "ALREADY DREW CMD nk_command_triangle_filled");
@ -868,7 +870,7 @@ void updateBounds(int top, int bottom, int left, int right) {
const struct nk_command_polygon *p = (const struct nk_command_polygon*)cmd;
#ifdef COMMAND_CACHING
if (!forceRedraw && cmd->type == lastCmd->type && memcmp(p, lastCmd, sizeof(struct nk_command_polygon)) == 0) {
if (!lastInputWasBackspace && cmd->type == lastCmd->type && memcmp(p, lastCmd, sizeof(struct nk_command_polygon)) == 0) {
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
writeSerialPortDebug(boutRefNum, "ALREADY DREW CMD nk_command_polygon");
@ -908,7 +910,7 @@ void updateBounds(int top, int bottom, int left, int right) {
const struct nk_command_polygon_filled *p = (const struct nk_command_polygon_filled*)cmd;
#ifdef COMMAND_CACHING
if (!forceRedraw && cmd->type == lastCmd->type && memcmp(p, lastCmd, sizeof(struct nk_command_polygon_filled)) == 0) {
if (!lastInputWasBackspace && cmd->type == lastCmd->type && memcmp(p, lastCmd, sizeof(struct nk_command_polygon_filled)) == 0) {
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
writeSerialPortDebug(boutRefNum, "ALREADY DREW CMD nk_command_polygon_filled");
@ -957,7 +959,7 @@ void updateBounds(int top, int bottom, int left, int right) {
const struct nk_command_polygon *p = (const struct nk_command_polygon*)cmd;
#ifdef COMMAND_CACHING
if (!forceRedraw && cmd->type == lastCmd->type && memcmp(p, lastCmd, sizeof(struct nk_command_polygon)) == 0) {
if (!lastInputWasBackspace && cmd->type == lastCmd->type && memcmp(p, lastCmd, sizeof(struct nk_command_polygon)) == 0) {
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
writeSerialPortDebug(boutRefNum, "ALREADY DREW CMD nk_command_polygon");
@ -1144,7 +1146,7 @@ NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
// TODO: if this becomes worth pursuing later, it causes address errors. I suspect that the memcpy
// command that builds up the last variable is not properly allocating memory.
// the address error pops up on the line of the conditional itself and can sometimes take hours to trigger.
if (currentCalls < lastCalls && lastCmd && lastCmd->next && lastCmd->next < ctx->memory.allocated) {
if (currentCalls < lastCalls && lastCmd && lastCmd->next) {
lastCmd = nk_ptr_add_const(struct nk_command, last, lastCmd->next);
}
@ -1190,6 +1192,7 @@ NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
#ifdef DRAW_BLIT_LOCATION
ForeColor(blackColor);
// FillRoundRect(&quickDrawRectangle, 0, 0, &qd.ltGray);
FrameRoundRect(&quickDrawRectangle, 0, 0);
#endif
@ -1360,6 +1363,9 @@ NK_API int nk_quickdraw_handle_event(EventRecord *event, struct nk_context *nukl
nk_input_key(nuklear_context, NK_KEY_SHIFT, isKeyDown);
} else if (key == deleteKey && isKeyDown) {
#ifdef COMMAND_CACHING
lastInputWasBackspace = true;
#endif
nk_input_key(nuklear_context, NK_KEY_DEL, isKeyDown);
} else if (key == enterKey) {
@ -1372,9 +1378,15 @@ NK_API int nk_quickdraw_handle_event(EventRecord *event, struct nk_context *nukl
nk_input_key(nuklear_context, NK_KEY_TAB, isKeyDown);
} else if (key == leftArrowKey) {
#ifdef COMMAND_CACHING
lastInputWasBackspace = true;
#endif
nk_input_key(nuklear_context, NK_KEY_LEFT, isKeyDown);
} else if (key == rightArrowKey) {
#ifdef COMMAND_CACHING
lastInputWasBackspace = true;
#endif
nk_input_key(nuklear_context, NK_KEY_RIGHT, isKeyDown);
} else if (key == upArrowKey) {