From: Jilles Tjoelker Date: Sat, 20 Mar 2004 19:36:57 +0000 (+0000) Subject: Implement ^W for delete word. X-Git-Tag: v1.6.1-roc-dev~419 X-Git-Url: https://skyeroc.xyz/gitweb/?a=commitdiff_plain;h=3a0b88ee121fc8564025041f46571f6f868d5b94;p=dgamelaunch Implement ^W for delete word. git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@284 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- diff --git a/mygetnstr.c b/mygetnstr.c index 0377806..e00a8de 100644 --- a/mygetnstr.c +++ b/mygetnstr.c @@ -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)