1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-13 01:03:03 +01:00

improve function

This commit is contained in:
Jfreegman 2014-06-04 14:41:36 -04:00
parent 97dedd32fb
commit 901ffbc7c0
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63

View File

@ -120,11 +120,16 @@ void rm_trailing_spaces_buf(wchar_t *buf, size_t *pos, size_t *len)
if (buf[*len - 1] != ' ')
return;
if (*pos == *len)
--(*pos);
int i;
buf[--(*len)] = L'\0';
rm_trailing_spaces_buf(buf, pos, len);
for (i = *len - 1; i >= 0; --i) {
if (buf[i] != ' ')
break;
}
*len = i + 1;
*pos = MIN(*pos, i + 1);
buf[*len] = L'\0';
}
#define HIST_PURGE MAX_LINE_HIST / 4