diff options
Diffstat (limited to 'testing/toxic')
-rw-r--r-- | testing/toxic/prompt.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c index 1db60883..a47238af 100644 --- a/testing/toxic/prompt.c +++ b/testing/toxic/prompt.c | |||
@@ -251,20 +251,21 @@ static void execute(ToxWindow* self, char* cmd) { | |||
251 | wprintw(self->window, "Message successfully sent.\n"); | 251 | wprintw(self->window, "Message successfully sent.\n"); |
252 | } | 252 | } |
253 | } | 253 | } |
254 | |||
255 | else if (!strncmp(cmd, "clear", strlen("clear"))) { | ||
256 | wclear(self->window); | ||
257 | } | ||
254 | else { | 258 | else { |
255 | wprintw(self->window, "Invalid syntax.\n"); | 259 | wprintw(self->window, "Invalid syntax.\n"); |
256 | } | 260 | } |
257 | } | 261 | } |
258 | 262 | ||
259 | static void prompt_onKey(ToxWindow* self, int key) { | 263 | static void prompt_onKey(ToxWindow* self, int key) { |
260 | |||
261 | // PRINTABLE characters: Add to line. | 264 | // PRINTABLE characters: Add to line. |
262 | if(isprint(key)) { | 265 | if(isprint(key)) { |
263 | |||
264 | if(prompt_buf_pos == (sizeof(prompt_buf) - 1)) { | 266 | if(prompt_buf_pos == (sizeof(prompt_buf) - 1)) { |
265 | return; | 267 | return; |
266 | } | 268 | } |
267 | |||
268 | prompt_buf[prompt_buf_pos++] = key; | 269 | prompt_buf[prompt_buf_pos++] = key; |
269 | prompt_buf[prompt_buf_pos] = 0; | 270 | prompt_buf[prompt_buf_pos] = 0; |
270 | } | 271 | } |
@@ -273,14 +274,12 @@ static void prompt_onKey(ToxWindow* self, int key) { | |||
273 | else if(key == '\n') { | 274 | else if(key == '\n') { |
274 | wprintw(self->window, "\n"); | 275 | wprintw(self->window, "\n"); |
275 | execute(self, prompt_buf); | 276 | execute(self, prompt_buf); |
276 | |||
277 | prompt_buf_pos = 0; | 277 | prompt_buf_pos = 0; |
278 | prompt_buf[0] = 0; | 278 | prompt_buf[0] = 0; |
279 | } | 279 | } |
280 | 280 | ||
281 | // BACKSPACE key: Remove one character from line. | 281 | // BACKSPACE key: Remove one character from line. |
282 | else if(key == 0x107 || key == 0x8 || key == 0x7f) { | 282 | else if(key == 0x107 || key == 0x8 || key == 0x7f) { |
283 | |||
284 | if(prompt_buf_pos != 0) { | 283 | if(prompt_buf_pos != 0) { |
285 | prompt_buf[--prompt_buf_pos] = 0; | 284 | prompt_buf[--prompt_buf_pos] = 0; |
286 | } | 285 | } |
@@ -315,6 +314,7 @@ static void print_usage(ToxWindow* self) { | |||
315 | wprintw(self->window, " nick <nickname> : Set your nickname\n"); | 314 | wprintw(self->window, " nick <nickname> : Set your nickname\n"); |
316 | wprintw(self->window, " accept <number> : Accept friend request\n"); | 315 | wprintw(self->window, " accept <number> : Accept friend request\n"); |
317 | wprintw(self->window, " myid : Print your ID\n"); | 316 | wprintw(self->window, " myid : Print your ID\n"); |
317 | wprintw(self->window, " clear : Clear the screen\n"); | ||
318 | wprintw(self->window, " quit/exit : Exit program\n"); | 318 | wprintw(self->window, " quit/exit : Exit program\n"); |
319 | wprintw(self->window, " help : Print this message again\n"); | 319 | wprintw(self->window, " help : Print this message again\n"); |
320 | 320 | ||