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:
15
src/input.c
15
src/input.c
@ -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);
|
||||
|
Reference in New Issue
Block a user