diff options
author | Nominate <thomas.bladon@st-hughs.ox.ac.uk> | 2013-08-06 08:10:05 +0100 |
---|---|---|
committer | Nominate <thomas.bladon@st-hughs.ox.ac.uk> | 2013-08-06 08:10:05 +0100 |
commit | 1f001b2f915710e254d039c1f74c533196826235 (patch) | |
tree | fe854d15fe03e0896f7c1709e107cd60c38b04d1 /testing/toxic | |
parent | 9613646af24090e02be831dafdd1405146cf75b5 (diff) |
Stops line-spamming and clears before printing help
This addresses one issue in #340 perfectly and slightly improves the other.
Diffstat (limited to 'testing/toxic')
-rw-r--r-- | testing/toxic/prompt.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c index 16750c5d..c832db39 100644 --- a/testing/toxic/prompt.c +++ b/testing/toxic/prompt.c | |||
@@ -159,10 +159,11 @@ static void execute(ToxWindow* self, char* cmd) { | |||
159 | } | 159 | } |
160 | } | 160 | } |
161 | else if(!strcmp(cmd, "clear")) { | 161 | else if(!strcmp(cmd, "clear")) { |
162 | wclear(self->window); | 162 | wclear(self->window); |
163 | } | 163 | } |
164 | else if(!strcmp(cmd, "help")) { | 164 | else if(!strcmp(cmd, "help")) { |
165 | print_usage(self); | 165 | wclear(self->window); |
166 | print_usage(self); | ||
166 | } | 167 | } |
167 | else if(!strncmp(cmd, "status ", strlen("status "))) { | 168 | else if(!strncmp(cmd, "status ", strlen("status "))) { |
168 | char* msg; | 169 | char* msg; |
@@ -265,8 +266,8 @@ static void execute(ToxWindow* self, char* cmd) { | |||
265 | static void prompt_onKey(ToxWindow* self, int key) { | 266 | static void prompt_onKey(ToxWindow* self, int key) { |
266 | // PRINTABLE characters: Add to line. | 267 | // PRINTABLE characters: Add to line. |
267 | if(isprint(key)) { | 268 | if(isprint(key)) { |
268 | if(prompt_buf_pos == (sizeof(prompt_buf) - 1)) { | 269 | if(prompt_buf_pos == (COLS - 3)) { |
269 | return; | 270 | return; |
270 | } | 271 | } |
271 | prompt_buf[prompt_buf_pos++] = key; | 272 | prompt_buf[prompt_buf_pos++] = key; |
272 | prompt_buf[prompt_buf_pos] = 0; | 273 | prompt_buf[prompt_buf_pos] = 0; |