Fix non-multiline command newline handling

master
C. McEnroe 2020-03-23 15:47:56 -04:00
parent ef6518a627
commit 35ae4121cb
1 changed files with 3 additions and 4 deletions

View File

@ -465,12 +465,11 @@ void command(uint id, char *input) {
uiFormat(id, Warm, NULL, "Command %s is restricted", cmd); uiFormat(id, Warm, NULL, "Command %s is restricted", cmd);
return; return;
} }
if (!(handler->flags & Multiline)) {
char *nl = strchr(input, '\n');
if (nl) *nl = '\0';
}
if (input) { if (input) {
if (!(handler->flags & Multiline)) {
input[strcspn(input, "\n")] = '\0';
}
input += strspn(input, " "); input += strspn(input, " ");
size_t len = strlen(input); size_t len = strlen(input);
while (input[len - 1] == ' ') input[--len] = '\0'; while (input[len - 1] == ' ') input[--len] = '\0';