Implement ^W for delete word.

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@284 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Jilles Tjoelker 2004-03-20 19:36:57 +00:00
parent 4429498e0b
commit 3a0b88ee12
1 changed files with 16 additions and 1 deletions

View File

@ -57,7 +57,7 @@ mygetnstr(char *buf, int maxlen, int doecho)
else
beep();
}
else if (c == 21 || c == 24 || c == KEY_DL)
else if (c == 21 || c == 24 || c == KEY_DL) /* ^U/^X */
{
while (i > 0)
{
@ -66,6 +66,21 @@ mygetnstr(char *buf, int maxlen, int doecho)
addstr("\010 \010");
}
}
else if (c == 23) /* ^W */
{
while (i > 0 && buf[i - 1] == ' ')
{
i--;
if (doecho)
addstr("\010 \010");
}
while (i > 0 && buf[i - 1] != ' ')
{
i--;
if (doecho)
addstr("\010 \010");
}
}
else if ((c >= ' ' && c <= '~') || (c >= 0xA0 && c <= 0xFF))
{
if (i < maxlen)