1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-06-30 08:26:45 +02:00

line edit support for home, del and end keys

This commit is contained in:
Jfreegman
2013-12-01 02:58:21 -05:00
parent 37dd2bee2d
commit 5850e1c333
4 changed files with 50 additions and 16 deletions

View File

@ -188,8 +188,8 @@ void add_char_to_buf(wint_t ch, wchar_t *buf, size_t *pos, size_t *len)
++(*len);
}
/* Deletes the character before pos via the backspace key */
void del_char_from_buf(wint_t ch, wchar_t *buf, size_t *pos, size_t *len)
/* Deletes the character before pos */
void del_char_buf_bck(wchar_t *buf, size_t *pos, size_t *len)
{
if (*pos <= 0)
return;
@ -211,7 +211,21 @@ void del_char_from_buf(wint_t ch, wchar_t *buf, size_t *pos, size_t *len)
--(*len);
}
/* sets pos and len to 0 */
/* Deletes the character at pos */
void del_char_buf_frnt(wchar_t *buf, size_t *pos, size_t *len)
{
if (*pos < 0 || *pos >= *len)
return;
int i;
for (i = *pos; i < *len; ++i)
buf[i] = buf[i+1];
--(*len);
}
/* nulls buf and sets pos and len to 0 */
void reset_buf(wchar_t *buf, size_t *pos, size_t *len)
{
buf[0] = L'\0';