Fixed the default debugger input to strip new lines, fixing the debugger in SDL

This commit is contained in:
Lior Halphon 2016-04-06 22:57:37 +03:00
parent eb0b642247
commit 1c2af7fa5b

View File

@ -97,9 +97,15 @@ static char *default_input_callback(GB_gameboy_t *gb)
size_t size = 0; size_t size = 0;
printf(">"); printf(">");
getline(&expression, &size, stdin); getline(&expression, &size, stdin);
if (!expression) { if (!expression) {
return strdup(""); return strdup("");
} }
size_t length = strlen(expression);
if (expression[length - 1] == '\n') {
expression[length - 1] = 0;
}
return expression; return expression;
} }