aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9term
diff options
context:
space:
mode:
authorPetter Rodhelind <petter.rodhelind@gmail.com>2020-01-14 11:41:08 +0100
committerPetter Rodhelind <petter.rodhelind@gmail.com>2020-01-14 11:41:08 +0100
commit02d7aa8915f9c3a3288dab01f321eb94ba219e3b (patch)
treef053238978479e408a2b83571443e132f30586ab /src/cmd/9term
parentc0c9d8f883dfd3a7f5a74499d91bb95884b15873 (diff)
parent3d1382b98a502d0c34d5ba2c462396acc515016e (diff)
downloadplan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.gz
plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.bz2
plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/cmd/9term')
-rw-r--r--src/cmd/9term/9term.c43
-rw-r--r--src/cmd/9term/SunOS.c1
-rw-r--r--src/cmd/9term/bsdpty.c3
-rw-r--r--src/cmd/9term/dat.h5
-rw-r--r--src/cmd/9term/data.c120
-rw-r--r--src/cmd/9term/fns.h1
-rw-r--r--src/cmd/9term/malloc.c7
-rw-r--r--src/cmd/9term/rcstart.c8
-rw-r--r--src/cmd/9term/util.c1
-rw-r--r--src/cmd/9term/win.c24
-rw-r--r--src/cmd/9term/wind.c39
11 files changed, 139 insertions, 113 deletions
diff --git a/src/cmd/9term/9term.c b/src/cmd/9term/9term.c
index 107afed3..b28f44fa 100644
--- a/src/cmd/9term/9term.c
+++ b/src/cmd/9term/9term.c
@@ -51,13 +51,13 @@ void
threadmain(int argc, char *argv[])
{
char *p;
-
+
rfork(RFNOTEG);
font = nil;
_wantfocuschanges = 1;
mainpid = getpid();
messagesize = 8192;
-
+
ARGBEGIN{
default:
usage();
@@ -80,7 +80,7 @@ threadmain(int argc, char *argv[])
winsize = EARGF(usage());
break;
}ARGEND
-
+
if(fontname)
putenv("font", fontname);
@@ -92,7 +92,7 @@ threadmain(int argc, char *argv[])
if(maxtab <= 0)
maxtab = 4;
free(p);
-
+
startdir = ".";
if(initdraw(derror, fontname, "9term") < 0)
@@ -100,7 +100,7 @@ threadmain(int argc, char *argv[])
notify(hangupnote);
noteenable("sys: child");
-
+
mousectl = initmouse(nil, screen);
if(mousectl == nil)
error("cannot find mouse");
@@ -181,13 +181,13 @@ void
resizethread(void *v)
{
Point p;
-
+
USED(v);
-
+
for(;;){
p = stringsize(display->defaultfont, "0");
if(p.x && p.y)
- updatewinsize(Dy(screen->r)/p.y, (Dx(screen->r)-Scrollwid-2)/p.x,
+ updatewinsize(Dy(screen->r)/p.y, (Dx(screen->r)-Scrollwid-2)/p.x,
Dx(screen->r), Dy(screen->r));
wresize(w, screen, 0);
flushimage(display, 1);
@@ -197,7 +197,7 @@ resizethread(void *v)
sysfatal("can't reattach to window");
}
}
-
+
void
mousethread(void *v)
{
@@ -229,7 +229,7 @@ mousethread(void *v)
bouncemouse(mouse);
}
}
-
+
void
wborder(Window *w, int type)
{
@@ -288,6 +288,7 @@ enum
Paste,
Snarf,
Plumb,
+ Look,
Send,
Scroll,
Cook
@@ -298,6 +299,7 @@ char *menu2str[] = {
"paste",
"snarf",
"plumb",
+ "look",
"send",
"cook",
"scroll",
@@ -348,6 +350,10 @@ button2menu(Window *w)
wplumb(w);
break;
+ case Look:
+ wlook(w);
+ break;
+
case Send:
riogetsnarf();
wsnarf(w);
@@ -399,7 +405,7 @@ rcoutputproc(void *arg)
Conswritemesg cwm;
Rune *r;
Stringpair pair;
-
+
i = 0;
cnt = 0;
for(;;){
@@ -426,11 +432,11 @@ rcoutputproc(void *arg)
if(nb < cnt)
memmove(data, data+nb, cnt-nb);
cnt -= nb;
-
+
nr = label(r, nr);
if(nr == 0)
continue;
-
+
recv(w->conswrite, &cwm);
pair.s = r;
pair.ns = nr;
@@ -442,7 +448,7 @@ void
winterrupt(Window *w)
{
char rubout[1];
-
+
USED(w);
rubout[0] = getintr(sfd);
write(rcfd, rubout, 1);
@@ -468,7 +474,7 @@ label(Rune *sr, int n)
{
Rune *sl, *el, *er, *r;
char *p, *dir;
-
+
er = sr+n;
for(r=er-1; r>=sr; r--)
if(*r == '\007')
@@ -521,7 +527,7 @@ rcinputproc(void *arg)
recv(w->consread, &crm);
c1 = crm.c1;
c2 = crm.c2;
-
+
pair.s = data;
pair.ns = sizeof data;
send(c1, &pair);
@@ -541,7 +547,7 @@ void
rioputsnarf(void)
{
char *s;
-
+
s = smprint("%.*S", nsnarf, snarf);
if(s){
putsnarf(s);
@@ -642,7 +648,7 @@ textproc(void *arg)
for(x=0; x<p-buf; x+=n)
if((n = write(fd, buf+x, (p-x)-buf)) <= 0)
goto break2;
-
+
if(i >= end)
break;
p = buf;
@@ -658,4 +664,3 @@ textproc(void *arg)
break2:
close(fd);
}
-
diff --git a/src/cmd/9term/SunOS.c b/src/cmd/9term/SunOS.c
index e0f866ab..73914a67 100644
--- a/src/cmd/9term/SunOS.c
+++ b/src/cmd/9term/SunOS.c
@@ -84,4 +84,3 @@ getintr(int fd)
return 0x7F;
return ttmode.c_cc[VINTR];
}
-
diff --git a/src/cmd/9term/bsdpty.c b/src/cmd/9term/bsdpty.c
index 31281325..d64e4c2f 100644
--- a/src/cmd/9term/bsdpty.c
+++ b/src/cmd/9term/bsdpty.c
@@ -20,7 +20,7 @@ static char *abc =
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789";
-static char *_123 =
+static char *_123 =
"0123456789"
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -111,4 +111,3 @@ getintr(int fd)
return 0x7F;
return ttmode.c_cc[VINTR];
}
-
diff --git a/src/cmd/9term/dat.h b/src/cmd/9term/dat.h
index c1af6592..a215253f 100644
--- a/src/cmd/9term/dat.h
+++ b/src/cmd/9term/dat.h
@@ -91,8 +91,8 @@ struct Mouseinfo
ulong counter; /* serial no. of last mouse event we received */
ulong lastcounter; /* serial no. of last mouse event sent to client */
int lastb; /* last button state we received */
- uchar qfull; /* filled the queue; no more recording until client comes back */
-};
+ uchar qfull; /* filled the queue; no more recording until client comes back */
+};
struct Window
{
@@ -177,6 +177,7 @@ void wmousectl(Window*);
void wmovemouse(Window*, Point);
void wpaste(Window*);
void wplumb(Window*);
+void wlook(Window*);
void wrefresh(Window*, Rectangle);
void wrepaint(Window*);
void wresize(Window*, Image*, int);
diff --git a/src/cmd/9term/data.c b/src/cmd/9term/data.c
index e0f18e87..4c2a7602 100644
--- a/src/cmd/9term/data.c
+++ b/src/cmd/9term/data.c
@@ -48,121 +48,121 @@ Cursor sightcursor = {
Cursor whitearrow = {
{0, 0},
- {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFC,
- 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF8, 0xFF, 0xFC,
- 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFC,
+ {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFC,
+ 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF8, 0xFF, 0xFC,
+ 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFC,
0xF3, 0xF8, 0xF1, 0xF0, 0xE0, 0xE0, 0xC0, 0x40, },
- {0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x06, 0xC0, 0x1C,
- 0xC0, 0x30, 0xC0, 0x30, 0xC0, 0x38, 0xC0, 0x1C,
- 0xC0, 0x0E, 0xC0, 0x07, 0xCE, 0x0E, 0xDF, 0x1C,
+ {0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x06, 0xC0, 0x1C,
+ 0xC0, 0x30, 0xC0, 0x30, 0xC0, 0x38, 0xC0, 0x1C,
+ 0xC0, 0x0E, 0xC0, 0x07, 0xCE, 0x0E, 0xDF, 0x1C,
0xD3, 0xB8, 0xF1, 0xF0, 0xE0, 0xE0, 0xC0, 0x40, }
};
Cursor query = {
{-7,-7},
- {0x0f, 0xf0, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe,
- 0x7c, 0x7e, 0x78, 0x7e, 0x00, 0xfc, 0x01, 0xf8,
- 0x03, 0xf0, 0x07, 0xe0, 0x07, 0xc0, 0x07, 0xc0,
+ {0x0f, 0xf0, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe,
+ 0x7c, 0x7e, 0x78, 0x7e, 0x00, 0xfc, 0x01, 0xf8,
+ 0x03, 0xf0, 0x07, 0xe0, 0x07, 0xc0, 0x07, 0xc0,
0x07, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xc0, },
- {0x00, 0x00, 0x0f, 0xf0, 0x1f, 0xf8, 0x3c, 0x3c,
- 0x38, 0x1c, 0x00, 0x3c, 0x00, 0x78, 0x00, 0xf0,
- 0x01, 0xe0, 0x03, 0xc0, 0x03, 0x80, 0x03, 0x80,
+ {0x00, 0x00, 0x0f, 0xf0, 0x1f, 0xf8, 0x3c, 0x3c,
+ 0x38, 0x1c, 0x00, 0x3c, 0x00, 0x78, 0x00, 0xf0,
+ 0x01, 0xe0, 0x03, 0xc0, 0x03, 0x80, 0x03, 0x80,
0x00, 0x00, 0x03, 0x80, 0x03, 0x80, 0x00, 0x00, }
};
Cursor tl = {
{-4, -4},
- {0xfe, 0x00, 0x82, 0x00, 0x8c, 0x00, 0x87, 0xff,
- 0xa0, 0x01, 0xb0, 0x01, 0xd0, 0x01, 0x11, 0xff,
- 0x11, 0x00, 0x11, 0x00, 0x11, 0x00, 0x11, 0x00,
+ {0xfe, 0x00, 0x82, 0x00, 0x8c, 0x00, 0x87, 0xff,
+ 0xa0, 0x01, 0xb0, 0x01, 0xd0, 0x01, 0x11, 0xff,
+ 0x11, 0x00, 0x11, 0x00, 0x11, 0x00, 0x11, 0x00,
0x11, 0x00, 0x11, 0x00, 0x11, 0x00, 0x1f, 0x00, },
- {0x00, 0x00, 0x7c, 0x00, 0x70, 0x00, 0x78, 0x00,
- 0x5f, 0xfe, 0x4f, 0xfe, 0x0f, 0xfe, 0x0e, 0x00,
- 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00,
+ {0x00, 0x00, 0x7c, 0x00, 0x70, 0x00, 0x78, 0x00,
+ 0x5f, 0xfe, 0x4f, 0xfe, 0x0f, 0xfe, 0x0e, 0x00,
+ 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00,
0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x00, 0x00, }
};
Cursor t = {
{-7, -8},
- {0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x06, 0xc0,
- 0x1c, 0x70, 0x10, 0x10, 0x0c, 0x60, 0xfc, 0x7f,
- 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xff, 0xff,
+ {0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x06, 0xc0,
+ 0x1c, 0x70, 0x10, 0x10, 0x0c, 0x60, 0xfc, 0x7f,
+ 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
- 0x03, 0x80, 0x0f, 0xe0, 0x03, 0x80, 0x03, 0x80,
- 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x00, 0x00,
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
+ 0x03, 0x80, 0x0f, 0xe0, 0x03, 0x80, 0x03, 0x80,
+ 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }
};
Cursor tr = {
{-11, -4},
- {0x00, 0x7f, 0x00, 0x41, 0x00, 0x31, 0xff, 0xe1,
- 0x80, 0x05, 0x80, 0x0d, 0x80, 0x0b, 0xff, 0x88,
- 0x00, 0x88, 0x0, 0x88, 0x00, 0x88, 0x00, 0x88,
+ {0x00, 0x7f, 0x00, 0x41, 0x00, 0x31, 0xff, 0xe1,
+ 0x80, 0x05, 0x80, 0x0d, 0x80, 0x0b, 0xff, 0x88,
+ 0x00, 0x88, 0x0, 0x88, 0x00, 0x88, 0x00, 0x88,
0x00, 0x88, 0x00, 0x88, 0x00, 0x88, 0x00, 0xf8, },
- {0x00, 0x00, 0x00, 0x3e, 0x00, 0x0e, 0x00, 0x1e,
- 0x7f, 0xfa, 0x7f, 0xf2, 0x7f, 0xf0, 0x00, 0x70,
- 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70,
+ {0x00, 0x00, 0x00, 0x3e, 0x00, 0x0e, 0x00, 0x1e,
+ 0x7f, 0xfa, 0x7f, 0xf2, 0x7f, 0xf0, 0x00, 0x70,
+ 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70,
0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x00, }
};
Cursor r = {
{-8, -7},
- {0x07, 0xc0, 0x04, 0x40, 0x04, 0x40, 0x04, 0x58,
- 0x04, 0x68, 0x04, 0x6c, 0x04, 0x06, 0x04, 0x02,
- 0x04, 0x06, 0x04, 0x6c, 0x04, 0x68, 0x04, 0x58,
+ {0x07, 0xc0, 0x04, 0x40, 0x04, 0x40, 0x04, 0x58,
+ 0x04, 0x68, 0x04, 0x6c, 0x04, 0x06, 0x04, 0x02,
+ 0x04, 0x06, 0x04, 0x6c, 0x04, 0x68, 0x04, 0x58,
0x04, 0x40, 0x04, 0x40, 0x04, 0x40, 0x07, 0xc0, },
- {0x00, 0x00, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80,
- 0x03, 0x90, 0x03, 0x90, 0x03, 0xf8, 0x03, 0xfc,
- 0x03, 0xf8, 0x03, 0x90, 0x03, 0x90, 0x03, 0x80,
+ {0x00, 0x00, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80,
+ 0x03, 0x90, 0x03, 0x90, 0x03, 0xf8, 0x03, 0xfc,
+ 0x03, 0xf8, 0x03, 0x90, 0x03, 0x90, 0x03, 0x80,
0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x00, 0x00, }
};
Cursor br = {
{-11, -11},
- {0x00, 0xf8, 0x00, 0x88, 0x00, 0x88, 0x00, 0x88,
- 0x00, 0x88, 0x00, 0x88, 0x00, 0x88, 0x00, 0x88,
- 0xff, 0x88, 0x80, 0x0b, 0x80, 0x0d, 0x80, 0x05,
+ {0x00, 0xf8, 0x00, 0x88, 0x00, 0x88, 0x00, 0x88,
+ 0x00, 0x88, 0x00, 0x88, 0x00, 0x88, 0x00, 0x88,
+ 0xff, 0x88, 0x80, 0x0b, 0x80, 0x0d, 0x80, 0x05,
0xff, 0xe1, 0x00, 0x31, 0x00, 0x41, 0x00, 0x7f, },
- {0x00, 0x00, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70,
- 0x0, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70,
- 0x00, 0x70, 0x7f, 0xf0, 0x7f, 0xf2, 0x7f, 0xfa,
+ {0x00, 0x00, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70,
+ 0x0, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70,
+ 0x00, 0x70, 0x7f, 0xf0, 0x7f, 0xf2, 0x7f, 0xfa,
0x00, 0x1e, 0x00, 0x0e, 0x00, 0x3e, 0x00, 0x00, }
};
Cursor b = {
{-7, -7},
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
- 0xfc, 0x7f, 0x0c, 0x60, 0x10, 0x10, 0x1c, 0x70,
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
+ 0xfc, 0x7f, 0x0c, 0x60, 0x10, 0x10, 0x1c, 0x70,
0x06, 0xc0, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, },
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe,
- 0x03, 0x80, 0x03, 0x80, 0x0f, 0xe0, 0x03, 0x80,
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe,
+ 0x03, 0x80, 0x03, 0x80, 0x0f, 0xe0, 0x03, 0x80,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }
};
Cursor bl = {
{-4, -11},
- {0x1f, 0x00, 0x11, 0x00, 0x11, 0x00, 0x11, 0x00,
- 0x11, 0x00, 0x11, 0x00, 0x11, 0x00, 0x11, 0x00,
- 0x11, 0xff, 0xd0, 0x01, 0xb0, 0x01, 0xa0, 0x01,
+ {0x1f, 0x00, 0x11, 0x00, 0x11, 0x00, 0x11, 0x00,
+ 0x11, 0x00, 0x11, 0x00, 0x11, 0x00, 0x11, 0x00,
+ 0x11, 0xff, 0xd0, 0x01, 0xb0, 0x01, 0xa0, 0x01,
0x87, 0xff, 0x8c, 0x00, 0x82, 0x00, 0xfe, 0x00, },
- {0x00, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00,
- 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00,
- 0x0e, 0x00, 0x0f, 0xfe, 0x4f, 0xfe, 0x5f, 0xfe,
+ {0x00, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00,
+ 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00,
+ 0x0e, 0x00, 0x0f, 0xfe, 0x4f, 0xfe, 0x5f, 0xfe,
0x78, 0x00, 0x70, 0x00, 0x7c, 0x00, 0x00, 0x0, }
};
Cursor l = {
{-7, -7},
- {0x03, 0xe0, 0x02, 0x20, 0x02, 0x20, 0x1a, 0x20,
- 0x16, 0x20, 0x36, 0x20, 0x60, 0x20, 0x40, 0x20,
- 0x60, 0x20, 0x36, 0x20, 0x16, 0x20, 0x1a, 0x20,
+ {0x03, 0xe0, 0x02, 0x20, 0x02, 0x20, 0x1a, 0x20,
+ 0x16, 0x20, 0x36, 0x20, 0x60, 0x20, 0x40, 0x20,
+ 0x60, 0x20, 0x36, 0x20, 0x16, 0x20, 0x1a, 0x20,
0x02, 0x20, 0x02, 0x20, 0x02, 0x20, 0x03, 0xe0, },
- {0x00, 0x00, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0,
- 0x09, 0xc0, 0x09, 0xc0, 0x1f, 0xc0, 0x3f, 0xc0,
- 0x1f, 0xc0, 0x09, 0xc0, 0x09, 0xc0, 0x01, 0xc0,
+ {0x00, 0x00, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0,
+ 0x09, 0xc0, 0x09, 0xc0, 0x1f, 0xc0, 0x3f, 0xc0,
+ 0x1f, 0xc0, 0x09, 0xc0, 0x09, 0xc0, 0x01, 0xc0,
0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x00, 0x00, }
};
diff --git a/src/cmd/9term/fns.h b/src/cmd/9term/fns.h
index 34cebf01..fd0bd74a 100644
--- a/src/cmd/9term/fns.h
+++ b/src/cmd/9term/fns.h
@@ -39,4 +39,3 @@ int intrc(void);
void rioputsnarf(void);
void riogetsnarf(void);
-
diff --git a/src/cmd/9term/malloc.c b/src/cmd/9term/malloc.c
index 130942bd..9132235b 100644
--- a/src/cmd/9term/malloc.c
+++ b/src/cmd/9term/malloc.c
@@ -13,7 +13,7 @@ void*
p9malloc(ulong n)
{
void *v;
-
+
if(n == 0)
n++;
lock(&malloclock);
@@ -38,7 +38,7 @@ void*
p9calloc(ulong a, ulong b)
{
void *v;
-
+
if(a*b == 0)
a = b = 1;
@@ -53,11 +53,10 @@ void*
p9realloc(void *v, ulong n)
{
void *vv;
-
+
lock(&malloclock);
vv = realloc(v, n);
unlock(&malloclock);
print("p9realloc %p %lud => %p; pc %lux\n", v, n, vv, getcallerpc(&v));
return vv;
}
-
diff --git a/src/cmd/9term/rcstart.c b/src/cmd/9term/rcstart.c
index fddabc6d..a447036d 100644
--- a/src/cmd/9term/rcstart.c
+++ b/src/cmd/9term/rcstart.c
@@ -69,15 +69,15 @@ rcstart(int argc, char **argv, int *pfd, int *tfd)
}
/*
* notedisable("sys: window size change");
- *
+ *
* Can't disable because will be inherited by other programs
* like if you run an xterm from the prompt, and then xterm's
- * resizes won't get handled right. Sigh.
+ * resizes won't get handled right. Sigh.
*
* Can't not disable because when we stty below we'll get a
* signal, which will drop us into the thread library note handler,
* which will get all confused because we just forked and thus
- * have an unknown pid.
+ * have an unknown pid.
*
* So disable it internally. ARGH!
*/
@@ -145,7 +145,7 @@ echoed(char *p, int n)
if(echo.w+n > sizeof echo.buf)
n = 0;
memmove(echo.buf+echo.w, p, n);
- echo.w += n;
+ echo.w += n;
unlock(&echo.l);
}
diff --git a/src/cmd/9term/util.c b/src/cmd/9term/util.c
index 8a35d1d7..32ea08b6 100644
--- a/src/cmd/9term/util.c
+++ b/src/cmd/9term/util.c
@@ -146,4 +146,3 @@ runetobyte(Rune *r, int n, int *ip)
*ip = m;
return s;
}
-
diff --git a/src/cmd/9term/win.c b/src/cmd/9term/win.c
index 017d546b..9c7a12eb 100644
--- a/src/cmd/9term/win.c
+++ b/src/cmd/9term/win.c
@@ -134,7 +134,7 @@ threadmain(int argc, char **argv)
char buf1[128];
CFsys *fs;
char *dump;
-
+
dump = onestring(argc, argv);
ARGBEGIN{
@@ -215,7 +215,7 @@ threadmain(int argc, char **argv)
fswrite(ctlfd, buf, strlen(buf));
sprint(buf, "scroll");
fswrite(ctlfd, buf, strlen(buf));
-
+
updatewinsize(25, 80, 0, 0);
proccreate(stdoutproc, nil, STACK);
stdinproc(nil);
@@ -225,7 +225,7 @@ void
error(char *s, ...)
{
va_list arg;
-
+
if(s){
va_start(arg, s);
s = vsmprint(s, arg);
@@ -378,11 +378,11 @@ stdinproc(void *v)
fprint(2, "shift typing %d... ", e.q1-e.q0);
q.p += e.q1-e.q0;
break;
-
+
case 'i':
case 'd': /* tag */
break;
-
+
default:
goto Unknown;
}
@@ -484,7 +484,7 @@ dropcr(char *p, int n)
{
int i;
char *w, *r, *q;
-
+
r = p;
w = p;
for(i=0; i<n; i++) {
@@ -538,15 +538,15 @@ stdoutproc(void *v)
n = read(fd1, buf+npart, 8192);
if(n <= 0)
error(nil);
-
+
n = echocancel(buf+npart, n);
if(n == 0)
continue;
-
+
n = dropcrnl(buf+npart, n);
if(n == 0)
continue;
-
+
n = dropcr(buf+npart, n);
if(n == 0)
continue;
@@ -581,13 +581,13 @@ stdoutproc(void *v)
buf[n] = 0;
n = label(buf, n);
buf[n] = 0;
-
+
// clumsy but effective: notice password
// prompts so we can disable echo.
password = 0;
if(cistrstr(buf, "password") || cistrstr(buf, "passphrase")) {
int i;
-
+
i = n;
while(i > 0 && buf[i-1] == ' ')
i--;
@@ -743,7 +743,7 @@ void
sendtype(int fd0)
{
int i, n, nr, raw;
-
+
raw = israw(fd0);
while(ntypebreak || (raw && ntypeb > 0)){
for(i=0; i<ntypeb; i++)
diff --git a/src/cmd/9term/wind.c b/src/cmd/9term/wind.c
index 13be22bc..da3fd2fc 100644
--- a/src/cmd/9term/wind.c
+++ b/src/cmd/9term/wind.c
@@ -104,7 +104,7 @@ wsetname(Window *w)
{
int i, n;
char err[ERRMAX];
-
+
n = sprint(w->name, "window.%d.%d", w->id, w->namecount++);
for(i='A'; i<='Z'; i++){
if(nameimage(w->i, w->name, 1) > 0)
@@ -227,7 +227,7 @@ winctl(void *arg)
crm.c2 = chancreate(sizeof(Stringpair), 0);
cwrm.c1 = chancreate(sizeof(Stringpair), 0);
cwrm.c2 = chancreate(sizeof(Stringpair), 0);
-
+
alts[WKey].c = w->ck;
alts[WKey].v = &kbdr;
@@ -806,7 +806,7 @@ wbswidth(Window *w, Rune c)
if(r == '\n'){ /* eat at most one more character */
if(q == w->q0 && c != '\r') /* eat the newline */
--q;
- break;
+ break;
}
if(c == 0x17){
eq = isalnum(r);
@@ -910,6 +910,31 @@ winborder(Window *w, Point xy)
}
void
+wlook(Window *w)
+{
+ int i, n, e;
+
+ i = w->q1;
+ n = i - w->q0;
+ e = w->nr - n;
+ if(n <= 0 || e < n)
+ return;
+
+ if(i > e)
+ i = 0;
+
+ while(runestrncmp(w->r+w->q0, w->r+i, n) != 0){
+ if(i < e)
+ i++;
+ else
+ i = 0;
+ }
+
+ wsetselect(w, i, i+n);
+ wshow(w, i);
+}
+
+void
wmousectl(Window *w)
{
int but;
@@ -1360,15 +1385,15 @@ wsetpid(Window *w, int pid, int dolabel)
}
}
-static Rune left1[] = {
+static Rune left1[] = {
'{', '[', '(', '<', 0xAB,
- 0x207d, 0x2329, 0x27e6, 0x27e8, 0x27ea,
- 0xfe59, 0xfe5b, 0xfe5d, 0xff08, 0xff3b, 0xff5b,
+ 0x207d, 0x2329, 0x27e6, 0x27e8, 0x27ea,
+ 0xfe59, 0xfe5b, 0xfe5d, 0xff08, 0xff3b, 0xff5b,
0
};
static Rune right1[] = {
'}', ']', ')', '>', 0xBB,
- 0x207e, 0x232a, 0x27e7, 0x27e9, 0x27eb,
+ 0x207e, 0x232a, 0x27e7, 0x27e9, 0x27eb,
0xfe5a, 0xfe5c, 0xfe5e, 0xff09, 0xff3d, 0xff5d,
0
};