mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 06:03:04 +01:00
improve function
This commit is contained in:
parent
97dedd32fb
commit
901ffbc7c0
@ -120,11 +120,16 @@ void rm_trailing_spaces_buf(wchar_t *buf, size_t *pos, size_t *len)
|
|||||||
if (buf[*len - 1] != ' ')
|
if (buf[*len - 1] != ' ')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (*pos == *len)
|
int i;
|
||||||
--(*pos);
|
|
||||||
|
|
||||||
buf[--(*len)] = L'\0';
|
for (i = *len - 1; i >= 0; --i) {
|
||||||
rm_trailing_spaces_buf(buf, pos, len);
|
if (buf[i] != ' ')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
*len = i + 1;
|
||||||
|
*pos = MIN(*pos, i + 1);
|
||||||
|
buf[*len] = L'\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
#define HIST_PURGE MAX_LINE_HIST / 4
|
#define HIST_PURGE MAX_LINE_HIST / 4
|
||||||
|
Loading…
Reference in New Issue
Block a user