mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-27 23:20:40 +00:00
Add support for M-d (kill_word) (#10654)
This commit is contained in:
parent
c1c4313f13
commit
f193a58382
@ -57,6 +57,22 @@ static void backward_kill_word() {
|
||||
}
|
||||
}
|
||||
|
||||
static void kill_word() {
|
||||
int i;
|
||||
for (i = I.buffer.index + 1; i < I.buffer.length && is_word_break_char (I.buffer.data[i]); i++) {
|
||||
/* Move the cursor index forward until we hit a non-word-break-character */
|
||||
}
|
||||
for (; i < I.buffer.length && !is_word_break_char (I.buffer.data[i]); i++) {
|
||||
/* Move the cursor index forward we hit a word-break-character */
|
||||
}
|
||||
if (I.buffer.index >= I.buffer.length) {
|
||||
I.buffer.length = I.buffer.index;
|
||||
}
|
||||
memmove (I.buffer.data + I.buffer.index, I.buffer.data + i,
|
||||
I.buffer.length - i + 1);
|
||||
I.buffer.length = strlen (I.buffer.data);
|
||||
}
|
||||
|
||||
static void unix_word_rubout() {
|
||||
int i;
|
||||
if (I.buffer.index > 0) {
|
||||
@ -1221,6 +1237,10 @@ R_API const char *r_line_readline_cb(RLineReadCallback cb, void *user) {
|
||||
I.buffer.index = 0;
|
||||
}
|
||||
break;
|
||||
case 'D':
|
||||
case 'd':
|
||||
kill_word ();
|
||||
break;
|
||||
case 'F':
|
||||
case 'f':
|
||||
// next word
|
||||
|
Loading…
Reference in New Issue
Block a user