mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Update prompt.c
This commit is contained in:
parent
45c84e55e6
commit
fb9791bc69
|
@ -44,12 +44,12 @@ static int prompt_buf_pos=0;
|
||||||
static void execute(ToxWindow* self, char* u_cmd) {
|
static void execute(ToxWindow* self, char* u_cmd) {
|
||||||
int i;
|
int i;
|
||||||
int newlines = 0;
|
int newlines = 0;
|
||||||
char cmd[256] = {0};
|
char cmd[256] = {0};
|
||||||
for(i = 0; i < strlen(prompt_buf); i++)
|
for(i = 0; i < strlen(prompt_buf); i++)
|
||||||
{
|
{
|
||||||
if (u_cmd[i] == '\n')
|
if (u_cmd[i] == '\n')
|
||||||
++newlines;
|
++newlines;
|
||||||
else
|
else
|
||||||
cmd[i - newlines] = u_cmd[i];
|
cmd[i - newlines] = u_cmd[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ static void execute(ToxWindow* self, char* u_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 == 255){
|
if (prompt_buf_pos == (sizeof(prompt_buf) - 1)){
|
||||||
wprintw(self->window, "\nToo Long.\n");
|
wprintw(self->window, "\nToo Long.\n");
|
||||||
prompt_buf_pos = 0;
|
prompt_buf_pos = 0;
|
||||||
prompt_buf[0] = 0;
|
prompt_buf[0] = 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user