diff options
| -rw-r--r-- | main.c | 3 | ||||
| -rw-r--r-- | main2.c | 8 |
2 files changed, 6 insertions, 5 deletions
@@ -76,7 +76,7 @@ int main() { // }
index = 0;
}
- else if (key == 8) {
+ else if (key == 8 || key == 127) {
if (numWords > 0) {
if (words[numWords-1].len == 1 && words[numWords-1].str[0] == '(') level--;
if (words[numWords-1].len == 1 && words[numWords-1].str[0] == ')') level++;
@@ -88,6 +88,7 @@ int main() { numWords++;
words[numWords-1].len = 0;
}
+ printw("%d\n", key);
words[numWords-1].str[index++] = (char)key;
words[numWords-1].len++;
}
@@ -272,7 +272,7 @@ GetInt() { int result = 0; int c; while ((c = getch()), (c != '\r') && (c != '\n')) { - if (c == 8 && intStrLen > 0) { + if ((c == 8 || c == 127) && intStrLen > 0) { intStrLen--; intStr[intStrLen] = '\0'; result /= 10; @@ -295,7 +295,7 @@ GetStr() { int strLen = 0; int c; while ((c = getch()), (c != '\r') && (c != '\n')) { - if (c == 8 && strLen > 0) { + if ((c == 8 || c == 127) && strLen > 0) { strLen--; str[strLen] = '\0'; Draw(g_Node, str); @@ -364,7 +364,7 @@ GetNode(JSONNode * parent) { break; } case 8: - //case 127: + case 127: JSONNodePop(parent); Draw(g_Node, ""); result = GetNode(parent); @@ -417,4 +417,4 @@ int main() { // JSONFree(n); return 0; -}
\ No newline at end of file +} |
