edit: Fix delete_word when not in the end of line
This commit is contained in:
parent
ee3b84beb3
commit
31e1206baa
1 changed files with 10 additions and 6 deletions
|
@ -130,13 +130,17 @@ static void delete_current(void)
|
|||
|
||||
static void delete_word(void)
|
||||
{
|
||||
int pos;
|
||||
|
||||
edit_clear_line();
|
||||
while (cmdbuf_len > 0 && cmdbuf[cmdbuf_len - 1] == ' ')
|
||||
cmdbuf_len--;
|
||||
while (cmdbuf_len > 0 && cmdbuf[cmdbuf_len - 1] != ' ')
|
||||
cmdbuf_len--;
|
||||
if (cmdbuf_pos > cmdbuf_len)
|
||||
cmdbuf_pos = cmdbuf_len;
|
||||
pos = cmdbuf_pos;
|
||||
while (pos > 0 && cmdbuf[pos - 1] == ' ')
|
||||
pos--;
|
||||
while (pos > 0 && cmdbuf[pos - 1] != ' ')
|
||||
pos--;
|
||||
os_memmove(cmdbuf + pos, cmdbuf + cmdbuf_pos, cmdbuf_len - cmdbuf_pos);
|
||||
cmdbuf_len -= cmdbuf_pos - pos;
|
||||
cmdbuf_pos = pos;
|
||||
edit_redraw();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue