didn't work, but does now.
authorEdward Wang <edward@ucbvax.Berkeley.EDU>
Fri, 29 Jul 1983 06:51:37 +0000 (22:51 -0800)
committerEdward Wang <edward@ucbvax.Berkeley.EDU>
Fri, 29 Jul 1983 06:51:37 +0000 (22:51 -0800)
SCCS-vsn: usr.bin/window/wwgets.c 1.6

usr/src/usr.bin/window/wwgets.c

index 4397f6d..93657c7 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)wwgets.c    1.5 83/07/28";
+static char *sccsid = "@(#)wwgets.c    1.6 83/07/28";
 #endif
 
 #include "defs.h"
 #endif
 
 #include "defs.h"
@@ -47,29 +47,39 @@ register struct ww *w;
 
        for (;;) {
                wwsetcursor(WCurRow(w->ww_win), WCurCol(w->ww_win));
 
        for (;;) {
                wwsetcursor(WCurRow(w->ww_win), WCurCol(w->ww_win));
-               while ((c = bpeekc()) < 0)
+               while ((c = bgetc()) < 0)
                        bread();
                        bread();
-               switch (c) {
-               case '\b':
-                       if (p > buf) {
-                               wwputs("\b \b", w);
-                               p--;
-                               if (ISCTRL(*p))
-                                       wwputs("\b \b", w);
-                       } else
+               if (c == wwoldtty.ww_sgttyb.sg_erase) {
+                       if (p > buf)
+                               rub(*--p, w);
+                       else
                                Ding();
                                Ding();
+               } else if (c == wwoldtty.ww_sgttyb.sg_kill) {
+                       while (p > buf)
+                               rub(*--p, w);
+               } else if (c == wwoldtty.ww_ltchars.t_werasc) {
+                       while (--p >= buf && (*p == ' ' || *p == '\t'))
+                               rub(*p, w);
+                       while (p >= buf && *p != ' ' && *p != '\t')
+                               rub(*p--, w);
+                       p++;
+               } else if (c == '\r' || c == '\n') {
                        break;
                        break;
-               case '\r':
-               case '\n':
-                       *p = 0;
-                       return;
-               default:
+               } else {
                        if (p >= buf + n - 1)
                                Ding();
                        if (p >= buf + n - 1)
                                Ding();
-                       else {
-                               *p++ = c;
-                               wwputs(unctrl(*p), w);
-                       }
+                       else
+                               wwputs(unctrl(*p++ = c), w);
                }
        }
                }
        }
+       *p = 0;
+}
+
+rub(c, w)
+struct ww *w;
+{
+       register i;
+
+       for (i = strlen(unctrl(c)); --i >= 0;)
+               wwputs("\b \b", w);
 }
 }