diff options
author | rsc <devnull@localhost> | 2005-11-11 00:37:14 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-11-11 00:37:14 +0000 |
commit | c21d0ab45b22db49ab83936a3bab4007f33187ee (patch) | |
tree | d0460b950d52218f8a0130948a5b5a8015255c00 | |
parent | c935adc6a2b4bcaa1729edf50ed91bfce9c0df91 (diff) | |
download | plan9port-c21d0ab45b22db49ab83936a3bab4007f33187ee.tar.gz plan9port-c21d0ab45b22db49ab83936a3bab4007f33187ee.tar.bz2 plan9port-c21d0ab45b22db49ab83936a3bab4007f33187ee.zip |
fixes
-rw-r--r-- | src/cmd/9term/9term.c | 6 | ||||
-rw-r--r-- | src/cmd/9term/wind.c | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/cmd/9term/9term.c b/src/cmd/9term/9term.c index 61ac1faa..cc85e95e 100644 --- a/src/cmd/9term/9term.c +++ b/src/cmd/9term/9term.c @@ -103,13 +103,13 @@ threadmain(int argc, char *argv[]) deletechan = chancreate(sizeof(char*), 0); timerinit(); + servedevtext(); rcpid = rcstart(argc, argv, &rcfd, &sfd); w = new(screen, FALSE, scrolling, rcpid, ".", nil, nil); threadcreate(keyboardthread, nil, STACK); threadcreate(mousethread, nil, STACK); threadcreate(resizethread, nil, STACK); - servedevtext(); proccreate(rcoutputproc, nil, STACK); proccreate(rcinputproc, nil, STACK); @@ -606,6 +606,10 @@ textproc(void *arg) fd = (int)arg; p = buf; ep = buf+sizeof buf; + if(w == nil){ + close(fd); + return; + } end = w->org+w->nr; /* avoid possible output loop */ for(i=w->org;; i++){ if(i >= end || ep-p < UTFmax){ diff --git a/src/cmd/9term/wind.c b/src/cmd/9term/wind.c index c59f08ec..e9d7ab0f 100644 --- a/src/cmd/9term/wind.c +++ b/src/cmd/9term/wind.c @@ -328,7 +328,8 @@ winctl(void *arg) recv(cwm.cw, &pair); rp = pair.s; nr = pair.ns; - up = bp = rp; + bp = rp; + up = rp; initial = 0; for(i=0; i<nr; i++){ switch(*bp){ @@ -340,7 +341,6 @@ winctl(void *arg) else --up; break; -/* case '\r': while(i<nr-1 && *(bp+1) == '\r'){ bp++; @@ -354,7 +354,6 @@ winctl(void *arg) }else if(i == nr-1) *up = '\n'; break; -*/ default: *up++ = *bp; break; @@ -368,8 +367,7 @@ winctl(void *arg) wdelete(w, qh, qh+initial); w->qh = qh; } - nr = rp - up; - rp[nr] = 0; + nr = up - rp; w->qh = winsert(w, rp, nr, w->qh)+nr; if(w->scrolling || w->mouseopen) wshow(w, w->qh); |