mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 22:33:02 +01:00
Stops line-spamming and clears before printing help
This addresses one issue in #340 perfectly and slightly improves the other.
This commit is contained in:
parent
5b13bacc53
commit
1701ed7023
9
prompt.c
9
prompt.c
@ -159,10 +159,11 @@ static void execute(ToxWindow* self, char* cmd) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!strcmp(cmd, "clear")) {
|
else if(!strcmp(cmd, "clear")) {
|
||||||
wclear(self->window);
|
wclear(self->window);
|
||||||
}
|
}
|
||||||
else if(!strcmp(cmd, "help")) {
|
else if(!strcmp(cmd, "help")) {
|
||||||
print_usage(self);
|
wclear(self->window);
|
||||||
|
print_usage(self);
|
||||||
}
|
}
|
||||||
else if(!strncmp(cmd, "status ", strlen("status "))) {
|
else if(!strncmp(cmd, "status ", strlen("status "))) {
|
||||||
char* msg;
|
char* msg;
|
||||||
@ -265,8 +266,8 @@ static void execute(ToxWindow* self, char* cmd) {
|
|||||||
static void prompt_onKey(ToxWindow* self, int key) {
|
static void prompt_onKey(ToxWindow* self, int key) {
|
||||||
// PRINTABLE characters: Add to line.
|
// PRINTABLE characters: Add to line.
|
||||||
if(isprint(key)) {
|
if(isprint(key)) {
|
||||||
if(prompt_buf_pos == (sizeof(prompt_buf) - 1)) {
|
if(prompt_buf_pos == (COLS - 3)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
prompt_buf[prompt_buf_pos++] = key;
|
prompt_buf[prompt_buf_pos++] = key;
|
||||||
prompt_buf[prompt_buf_pos] = 0;
|
prompt_buf[prompt_buf_pos] = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user