]> skyeroc.xyz Git - dgamelaunch/commitdiff
Implement ^W for delete word.
authorJilles Tjoelker <jilles@stack.nl>
Sat, 20 Mar 2004 19:36:57 +0000 (19:36 +0000)
committerJilles Tjoelker <jilles@stack.nl>
Sat, 20 Mar 2004 19:36:57 +0000 (19:36 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@284 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

mygetnstr.c

index 0377806de743f64293f8bf8ad4cf04560774863e..e00a8def2d9302aacd99a2f57cf847f3528674d1 100644 (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)