Mercurial > hg > nnchat
comparison main.c @ 451:733396469e5d
Cosmetic cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 26 May 2012 05:09:49 +0300 |
parents | a8373a1ce1eb |
children | bb65460c7aa2 |
comparison
equal
deleted
inserted
replaced
450:a8373a1ce1eb | 451:733396469e5d |
---|---|
1410 | 1410 |
1411 | 1411 |
1412 BOOL nn_tabcomplete_buffer(nn_editbuf_t *buf) | 1412 BOOL nn_tabcomplete_buffer(nn_editbuf_t *buf) |
1413 { | 1413 { |
1414 static char *previous = NULL, *pattern = NULL; | 1414 static char *previous = NULL, *pattern = NULL; |
1415 char *str = buf->data; | |
1415 BOOL again = FALSE, hasSeparator = FALSE, | 1416 BOOL again = FALSE, hasSeparator = FALSE, |
1416 hasSpace, newPattern = FALSE, isCommand; | 1417 hasSpace, newPattern = FALSE, isCommand; |
1417 char *str = buf->data; | |
1418 size_t endPos, startPos = buf->pos; | 1418 size_t endPos, startPos = buf->pos; |
1419 | 1419 |
1420 // previous word | 1420 // previous word |
1421 if (startPos >= 2 && str[startPos - 1] == ' ' && str[startPos - 2] != ' ') | 1421 if (startPos >= 2 && str[startPos - 1] == ' ' && str[startPos - 2] != ' ') |
1422 { | 1422 { |
1454 if (startPos > 0) | 1454 if (startPos > 0) |
1455 return FALSE; | 1455 return FALSE; |
1456 hasSeparator = TRUE; | 1456 hasSeparator = TRUE; |
1457 } | 1457 } |
1458 | 1458 |
1459 hasSpace = (buf->pos > 0 && str[buf->pos - 1] == ' ') || | 1459 hasSpace = (buf->pos > 0 && str[buf->pos - 1] == ' ') || |
1460 (buf->pos <= buf->len && str[buf->pos] == ' '); | 1460 (buf->pos <= buf->len && str[buf->pos] == ' '); |
1461 | 1461 |
1462 if (newPattern) | 1462 if (newPattern) |
1463 { | 1463 { |
1464 // Get pattern, check if it matches previous pattern and set 'again' flag | 1464 // Get pattern, check if it matches previous pattern and set 'again' flag |