1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-06-28 18:36:45 +02:00

implement word deletion via ^W

This commit is contained in:
Jfreegman
2014-10-05 23:12:58 -04:00
parent e5d45fdf1d
commit 43552161f9
5 changed files with 57 additions and 3 deletions

View File

@ -83,6 +83,17 @@ static void input_delete(ToxWindow *self)
sound_notify(self, error, 0, NULL);
}
/* delete last typed word */
static void input_del_word(ToxWindow *self, int x, int mx_x)
{
ChatContext *ctx = self->chatwin;
if (del_word_buf(ctx) == -1) {
sound_notify(self, error, 0, NULL);
return;
}
}
/* deletes entire line before cursor from input field and buffer */
static void input_discard(ToxWindow *self)
{
@ -213,6 +224,10 @@ bool input_handle(ToxWindow *self, wint_t key, int x, int y, int mx_x, int mx_y)
input_yank(self, x, mx_x);
break;
case T_KEY_C_W:
input_del_word(self, x, mx_x);
break;
case KEY_HOME:
case T_KEY_C_A:
input_mv_home(self);